home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_200 / 230_01 / docs.bun (.txt) < prev    next >
Microsoft Windows Help File Content  |  1987-05-25  |  118KB  |  3,224 lines

  1. : To unbundle, sh this file
  2. echo unbundling READ_ME 1>&2
  3. cat >READ_ME <<'End'
  4. Some of the material in this subdirectory is now out of date- having been
  5. superceded by the material in the book A Little Smalltalk, published by
  6. Addiso-Wesley.  So everybody run out and buy a copy of the book, ok?
  7. echo unbundling Makefile 1>&2
  8. cat >Makefile <<'End'
  9. TROFF = vtroff
  10. DITROFF = vtroff
  11. FILES = READ_ME Makefile macros books BUGS INDEX \
  12. install userman apndx1 st.1 syntax
  13. INDEX: books
  14.     invert books
  15. installguide:
  16.     $(TROFF) -ms install
  17. manbody: INDEX
  18.     bib userman | tbl | $(TROFF) -ms
  19. appendix1: apndx1 macros
  20.     tbl apndx1 | $(TROFF) -ms
  21. appendix2:
  22.     $(TROFF) -man man
  23. appendix3:
  24.     pic syntax | $(DITROFF) -ms
  25. bundle: $(FILES)
  26.     bundle $(FILES) >../docs.bundle
  27. echo unbundling macros 1>&2
  28. cat >macros <<'End'
  29. .\" macros for producing descriptions of classes
  30. .ds CM
  31. .de Nm
  32. .ds LH
  33. .Im 0 \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8
  34. .ds LH class \\fB\\$\\n(.$\\fP (continued)
  35. .in 0
  36. .de Im
  37. .in \\$1
  38. .if 2=\\n(.$ .ft B
  39. .if 2<\\n(.$ .Im \\$1+2m \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
  40. .de Rs  \" respondsTo:
  41. .ne 4v
  42. .IP \\fI\\$2\\fP\\h'2m-\\w'\\fI\\$2\\fI'u'\\$1 15m
  43. .de Ex   \" Examples
  44. .ne 10v
  45. Examples
  46. .if 0=\\n(.$ .ta 4i
  47. .el .ta \\$1
  48.      Printed result
  49. .de Sx
  50. echo unbundling books 1>&2
  51. cat >books <<'End'
  52. %T Smalltalk-80, The Language and It's Implementation
  53. %A Adele Goldberg
  54. %A David Robson
  55. %I Addison-Wesley
  56. %D 1983
  57. %K blue
  58. %T Smalltalk-80 The Interactive Programming Environment
  59. %A Adele Goldberg
  60. %I Addison-Wesley
  61. %D 1984
  62. %K orange
  63. %T Smalltalk-80 Bits of History, Words of Advice
  64. %A Glenn Krasner
  65. %I Addison-Wesley
  66. %D 1983
  67. %K green
  68. echo unbundling BUGS 1>&2
  69. cat >BUGS <<'End'
  70. KNOWN BUGS
  71. 1/1/85 assigning a block to a variable will usually cause memory reference
  72.     cycles, resulting in the number of increments and decrements not
  73.     being equal following execution.
  74.     (not really a bug, caused by the implementation - blocks need to
  75.     access the context, which includes the local variables, which
  76.     includes the block, which needs to access the context ... )
  77. 1/1/85    The stack size allocated by the parser is fixed.  It should be
  78.     computed by the parser and varied for different methods.
  79. 1/1/85  system should be modified to allow execution on system with no
  80.     ``system()'' system call (whew!).  This would involve using two
  81.     programs - a parser to take class descriptions and turn them into
  82.     internal form, and the smalltalk system.  Should be easy to do,
  83.     however.
  84. 2/1/85    fast loading does not work on the HP9000
  85. 4/1/85    if you modify the class Smalltalk (and thereby the pseudo variable
  86.     smalltalk) the pseudo variable does not get properly initialized.
  87. 4/1/85    Because of bootstrapping peculiarities, a few classes (such as
  88.     Object or Symbol or String) do not respond to the message ``variables''
  89.     correctly.
  90. echo unbundling INDEX 1>&2
  91. cat >INDEX <<'End'
  92. 1983 :books 0/122 234/101
  93. 1984 :books 123/110
  94. addiso :books 0/122 123/110 234/101
  95. adele :books 0/122 123/110
  96. advice :books 234/101
  97. bits :books 234/101
  98. blue :books 0/122
  99. david :books 0/122
  100. enviro :books 123/110
  101. glenn :books 234/101
  102. goldbe :books 0/122 123/110
  103. green :books 234/101
  104. histor :books 234/101
  105. implem :books 0/122
  106. intera :books 123/110
  107. its :books 0/122
  108. krasne :books 234/101
  109. langua :books 0/122
  110. orange :books 123/110
  111. progra :books 123/110
  112. robson :books 0/122
  113. smallt :books 0/122 123/110 234/101
  114. words :books 234/101
  115. echo unbundling install 1>&2
  116. cat >install <<'End'
  117. \fBLittle Smalltalk Installation Notes\fP
  118. Installation Notes
  119. There are four basic steps involved in installing the Little Smalltalk
  120. system.  The four steps are; unbundling the sources, editing the sources to
  121. tailor them to the target installation, compiling the sources, and moving
  122. the final binary to the local executables directory.  Each of these four
  123. steps are described in following paragraphs and in succeeding sections.
  124. .ds RF \(DY
  125. As distributed, the Little Smalltalk source consists of a small number of
  126. files in ``bundle'' format.  A shell script, \fBunbundle\fP, is provided
  127. that creates the various subdirectories used by the system and unbundles
  128. the distribution files into their component parts.  To execute this shell
  129. script, type, in a directory containing all the files in the distribution,
  130. the following command:
  131. .DS I
  132. sh unbundle
  133. A large amount of output should follow, indicating files have been
  134. unbundled into subdirectories /sources, /parser, /prelude, /tests, /docs
  135. and /bin.
  136. There are a small number of editing changes required to tailor the system to
  137. various different environments.  Section 2 describes these changes in detail for
  138. various types of machines and operating systems.
  139. Once the necessary tailoring has been performed, the system can then be
  140. compiled by typing the command:
  141. .DS I
  142. make install
  143. in the base directory (the original directory from which the source was
  144. unbundled).  This command will then invoke further make commands which
  145. produce the parser, the executable system, and the standard prelude.
  146. In addition various self checks for correctness are provided.  Should it be
  147. necessary, various subcomponents of the system can be individually produced
  148. by typing the ``make install'' commands in the appropriate subdirectory.
  149. These commands produce a considerable amount of output.
  150. Once the system has been compiled and successfully passed all self tests,
  151. the executable file in /bin/st should be linked or moved to the appropriate
  152. location for local executables on the target system.
  153. Finally, the object files for all compilations can be removed by typing
  154. ``make clean''.
  155. .NH 1
  156. Specific Machine Installation Instructions
  157. A single source form and command syntax cannot be used for all combinations of
  158. machine / operating systems, because of differences in library routine syntax
  159. or function availability.  An attempt has been made to surround the occurrences
  160. of such features with conditional compilation directives, so that by defining
  161. or not defining a symbol the correct result can be produced on different
  162. systems.  These commands have all been collected in the include file
  163. parser/env.h, so for the most part this should be the principle file needing
  164. to be edited.  In addition, ``meta-defines'' are provided for many systems to
  165. which the Little Smalltalk system has already been ported.  By defining one
  166. of these ``meta-defines'', correct values are given for the remainder of the
  167. symbols.
  168. Similarly, the ``standard'' set of flags necessary to use the compiler and/or
  169. loader differ from system to system.  These are given by the two defined
  170. strings, CFLAGS and LFLAGS, in sources/Makefile and parser/Makefile.
  171. As distributed, the Little Smalltalk system expects the various
  172. subdirectories to remain in the relationship in which they are unbundled.
  173. If desired, however, they can be moved (say to place the sources in one
  174. place, the libraries in another, and the binary in a third).  Each makefile
  175. may contain one of either the strings BINDIR or PARSEDIR at the beginning.
  176. If the binary or parser sources directory is moved, relative the the
  177. directory containing the makefile,
  178. these strings should be changed.  Otherwise, if the
  179. relative positions of the directories remain as they were unbundled, the
  180. default values for these strings can be used.
  181. There are a few places where path specifications must be given in either
  182. the Makefiles or in C sources.  These are described in the following sections.
  183. Finally, bytecodes are kept in the form of ``unsigned characters''; that is,
  184. characters containing numbers from 0-255.  These may or may not be
  185. supported on various machines.  The file parser/env.h contains a typedef
  186. for the type `uchar' and two macros for converting from unsigned characters
  187. to integers and back again.  These should be defined in such a manner that
  188. the appearance of unsigned characters is achieved, whether or not they are
  189. actually supported.  A simple test program, called uchar.c, is provided in
  190. /parser.  This program can be used to test the correctness of the macros
  191. defined in env.h.
  192. Generally, either the model of the VAX-780 or the PDP11/70 should be sufficient.
  193. .NH 2
  194. Bringing Little Smalltalk Up on a New System
  195. If the system you are attempting to port to is not one of the systems described
  196. in the following sections, a certain amount of experimentation will probably be
  197. necessary to successfully install the system.  This section will describe some
  198. of the major changes required; what other changes may be necessary is
  199. generally unpredictable.
  200. The strings CFLAGS and LFLAGS in sources/Makefile and parser/Makefile should
  201. be set to the appropriate values for ``normal'' compiles and loads of
  202. C programs.
  203. The file prelude/Makefile contains a hard path in the string PREPATH.
  204. This should be set to the path to the prelude directory.
  205. The file parser/env.h contains various hard paths, which are described in
  206. that file.  Also in that file, the following symbols should be defined or
  207. left undefined, depending upon the availability of various features.
  208. .IP CURSES 1i
  209. This symbol should be defined if it is desired to provide the simple ascii
  210. graphics given by the curses and termcap packages.  See section on
  211. graphics below.
  212. .IP ENVSAVE 1i
  213. This symbol should be defined if it is necessary to save the value of the
  214. global varible \fIenviron\fP during a fastload.
  215. This is necessary on the 11/70, IBM PC, possibly other machines.
  216. .IP FACTMAX 1i
  217. This symbol should be defined to be the largest integer for which the factorial
  218. can be computed by repeated multiplication without overflow.
  219. This value is generally 12 for 32 bit machines and 8 for 16 bit machines.
  220. .IP FASTDEFAULT 1i
  221. This symbol should be defined if the default behavior of the system should
  222. be to perform a fast load on the standard prelude (see section 3).
  223. .IP FLUSHREQ 1i
  224. If defined a fflush() is given after every call to printf.
  225. .IP GAMMA 1i
  226. This symbol should be defined if the gamma() function is part of the standard
  227. math library, left undefined otherwise.
  228. .IP INLINE 1i
  229. This symbol should be defined if in-line code is desired for object increments
  230. and decrements.  In line code is generally slightly faster, although the code
  231. size is slightly larger.  If this symbol is not defined subroutine calls
  232. will be generated for object increments and decrements.
  233. .IP NOSYSTEM 1i
  234. This symbol should be defined on non-unix systems for which the
  235. ``system()'' call is not supported.  As this seriously limits functionality
  236. (i.e. class descriptions cannot be modified during execution) is should not
  237. be used unless necessary.
  238. .IP OPEN3ARG 1i
  239. This symbol should be defined if Berkeley 4.2 style open
  240. statements (3 arguments)
  241. are used.  If the older, 2 argument, format is used this symbol should be left
  242. undefined.
  243. .IP PLOT3 1i
  244. This symbol should be defined if you have terminals for which the plot(3)
  245. routines can write directly to the screen, rather than requiring a
  246. postprocessing filter.  See section on graphics below.
  247. .IP SETJUMP 1i
  248. This symbol should be defined if the setjump/longjump facility is
  249. available.  This is used ONLY in the file sources/process.c to implement
  250. recovery when the user has typed an interrupt character.
  251. .IP SHORTDATA 1i
  252. If this symbol is defined various heuristics are used to reduce the data
  253. segment size, at the expense of functionality or execution speed.  Should
  254. only be defined if absolutely necessary.
  255. .IP SIGS
  256. This symbol should be defined if the signals facility is available.  This
  257. is used ONLY in the file sources/process.c to implement recovery when the
  258. user has typed an interrupt character.
  259. Also in parser/env.h, defines are provided to implement the datatype
  260. ``unsigned character''.  These were described in the last section.  Generally,
  261. either following the model of the VAX-780 or the PDP11/70 should be sufficient
  262. for most machines.
  263. .NH 2
  264. Berkeley lookalikes
  265. It has been reported that following the directions for Berkeley 4.2
  266. (below) is also sufficient for the following systems:
  267. .DS I
  268. Ahmdal / System V
  269. Pyramid 90x / System V
  270. Sequent Balance 8000
  271. .NH 2
  272. Berkeley near-lookalikes
  273. It has also been reported that following the directions for Berkeley 4.2 is
  274. sufficient for installation on the following systems, with the
  275. one change that the symbol ENVSAVE should be defined in parser/env.h.
  276. Note that on these systems, and other systems sharing the same
  277. characteristics, the only indication that ENVSAVE should be defined will be
  278. an obscure error message (usually ``-f: is not an identifier'') produced by the
  279. shell if an attempt is made to load a class description following a
  280. fast-load.
  281. .DS I
  282. Plexus P/35
  283. Tektronix 6130 (presumably other Tek 61xx and 62xx machines).
  284. .NH 2
  285. AT&T 3B2, System V
  286. The 3B2 does not have floating point hardware, and thus requires floating
  287. point simulation software being linked in.  This is accomplished by adding
  288. ``\-f'' to CFLAGS \fIand\fP LFALGS in the makefiles in /sources and
  289. /parser.  Other than for this change, the instructions for Berkeley 4.2 can
  290. be used for the installation.
  291. .NH 2
  292. Dec Professional 350
  293. In parser/Makefile the strings CFLAGS and LFLAGS should be left blank.
  294. In sources/Makefile, however, the string CFLAGS should be defined to be ``\-m'',
  295. to indicate the use of the code-mapping feature.  The normal construction rule
  296. for the executable file st should be commented out, and the more complicated
  297. loader instruction inserted in its place.  The appropriate rule is given in
  298. a comment in the Makefile.
  299. The string PREPATH in prelude/Makefile should be defined to be the path to
  300. the prelude directory (this can be discovered by typing ``pwd'' in the
  301. prelude directory).
  302. In parser/env.h the ``meta-define'' DECPRO should be given, and any other
  303. meta-defines removed.
  304. Also in env.h the paths in the strings TEMPFILE, PARSER and PRELUDE should
  305. be defined.  Note that /usr/tmp is not standard on Venix systems, and /tmp
  306. should be used instead.
  307. Because of the severe memory limitations on this machine, only Smalltalk
  308. programs that produce a relatively small number of objects can be executed.
  309. In fact, some of the later self tests fail with ``can't happen 1'' (out of
  310. memory space).
  311. Also, as more primitives are added to the system the size of primitive.o
  312. keeps creeping towards the magic 8K limit on object file sizes for the code
  313. mapping feature.  Eventually it may be necessary to split primitive.c into
  314. two files in order to avoid this problem.
  315. .NH 2
  316. HP 9000 / HP-UX
  317. Follow the instructions for the VAX 780 / Berkeley 4.2 (below) with the
  318. exception that the meta-define should be given as HP9000 instead of BERK42.
  319. Note that in the filenames in env.h that /usr has been changed to /users,
  320. except for /usr/tmp, which hasn't (a foolish consistency is the hobgoblin
  321. of little minds).
  322. The fastsave routines have not been adapted to the HP extended memory
  323. system, and thus fastsave should not be used.
  324. .NH 2
  325. IBM PC-XT
  326. It has been reported that the instructions given for the PDP 11/70 (below)
  327. are also sufficient for the IBM PC-XT running PC/IX.
  328. .NH 2
  329. PDP 11/70 (also 11/44)
  330. In sources/Makefile and parser/Makefile the string CFLAGS should be left blank,
  331. however LFLAGS should be set to ``\-i'' to indicate the use of
  332. separate instruction and data spaces.
  333. The string PREPATH in prelude/Makefile should be defined to be the path to
  334. the prelude directory (this can be discovered by typing ``pwd'' in the
  335. prelude directory).
  336. In parser/env.h the ``meta-define'' PDP1170 should be given, and any other
  337. meta-defines removed.
  338. Also in env.h the paths in the strings TEMPFILE, PARSER and PRELUDE should
  339. be defined.
  340. .NH 2
  341. Perkin Elmer
  342. The Perkin Elmer supports unsigned characters the same as the VAX, however
  343. it does not have the gamma function in the standard library.  Follow the
  344. instructions for the VAX/4.2, using the meta-define PERKELM.
  345. .NH 2
  346. RIDGE / ROS 3.0
  347. Follow the instructions for the VAX 780 /Berkeley 4.2 (below),
  348. with the exception that the
  349. meta-define should be given as RIDGE instead of BERK42.
  350. The fast save feature does not work on the Ridge.
  351. .NH 2
  352. VAX 780 / Berkeley 4.2
  353. In parser/Makefile and sources/Makefile the strings CFLAGS and LFLAGS should
  354. both be left blank.
  355. The string PREPATH in prelude/Makefile should be defined to be the path to
  356. the prelude directory (this can be discovered by typing ``pwd'' in the
  357. prelude directory).
  358. In parser/env.h the ``meta-define'' BERK42 should be given, and any other
  359. meta-defines removed.
  360. Also in env.h the paths in the strings TEMPFILE, PARSER and PRELUDE should
  361. be defined.
  362. (VAX only) If the \-g flag is used the define FLUSHREQ need not be given
  363. (although it
  364. will work if it is present), otherwise FLUSHREQ should be defined in order
  365. for input and output to interleave correctly.
  366. As distributed, the system does not perform a fastload (see next section)
  367. automatically.  If fastload works this can be made default by defining the
  368. symbol FASTDEFAULT.
  369. These instructions appear to work also for the SUN workstation; of course,
  370. if you have a SUN workstation you can run the Xerox system.
  371. Fast Loading
  372. The Little Smalltalk system has the ability to save and restore a user
  373. environment by basically moving a copy of all of the users data space into
  374. a file.  Although this produces rather large files, the savings in time
  375. permitted by not having to recreate a specific environment can be
  376. substantial.  Because this is such an unusual thing to do, it is probably
  377. wise, if installing the system on a new machine/operating system, to first
  378. comment out the define for FASTDEFAULT in parser/env.h,
  379. which will install a system which will not default to doing a fast load.
  380. Once such a system has been created and passed all self tests, you can
  381. experiment with fast loading by executing the st command with the argument
  382. \-f.  For test cases you can use the programs in /tests.  If it appears to
  383. be successful, then (by defining the variable FASTDEFAULT) you should
  384. regenerate the system so that the default behavior is to do a fast loading.
  385. (When regenerating the system, sources/main.c should be the only file
  386. needing to be recompiled).
  387. Fastloading does not currently work on the HP-9000.
  388. It may not work on other machines as well.
  389. Protections
  390. The directories /sources and /parser need not be readable by casual users.
  391. The directory /prelude contains files, however, which must be loaded by
  392. the Little Smalltalk system prior to every execution.  The protection of this
  393. directory, and on the files in it, should therefore be such that all users
  394. have READ access.
  395. Although the /tests directory is only used during system installation,
  396. users may want to refer to it for examples of class descriptions and to see
  397. how various problems (8 queens, dinning philosophers) have been solved in
  398. Smalltalk.
  399. Allowing all users access to the /docs directory will permit a kind of
  400. on-line access, however users should not be allowed to modify any files in
  401. any directory.
  402. Non-UNIX systems
  403. Non-UNIX\s-2\u*\d\s+2
  404. * UNIX is a trademark of AT&T Bell Laboratories.
  405. systems which do not support multiple user processes, and thus the
  406. system() call, cannot at current run Little Smalltalk.  There are plans,
  407. however, to at some time in the future support such systems.  This section
  408. will describe, in broad terms, the changes required.  The detailed changed
  409. are, of course, at the moment not known.
  410. First, the defined value NOSYSTEM must be given in parser/env.h.  This
  411. will cause all occurrences of the ``system()'' call to be commented out,
  412. and in most cases be replaced by error messages.
  413. Next, the parser must be modified to place its output in a file (presumably
  414. the file given as argument with .st replaced by .p) instead of the standard
  415. output.  This is a trivial, although probably system specific, change.
  416. In use, the user would then be required to ``compile'' all class
  417. descriptions by running the parser (which therefore would have to be user
  418. accessible program) before running the Little Smalltalk system.  Little
  419. Smalltalk could not be used to edit class descriptions on the fly \- the
  420. user would have to leave the system, perform the edit, and return to the
  421. system.  This would seriously limit functionality and utility, but that is
  422. cost of not running UNIX!
  423. Graphics
  424. The nice bit-mapped graphics display of the Smalltalk-80 system is,
  425. unfortunately, not very portable to conventional machines running
  426. conventional ascii terminals.
  427. Two mutually exclusive approaches have been furnished
  428. for providing \fBvery\fP rudimentary but
  429. nevertheless relatively device-independent graphics capabilities.
  430. The first approach used the curses(3) and termlib(3) routines to provide
  431. simple ascii (character-level) graphics.
  432. To use these, define
  433. the symbol CURSES in parser/env.h, and modify the Makefile in /sourses
  434. adding the libraries -lcurses and -ltermlib (or termcap, whichever is
  435. appropriate) to the symbol LIB.
  436. The functionality so provided can be described as follows:
  437. .IP clearScreen 1i
  438. This message is accepted by the pseudo-variable smalltalk and clears the
  439. screen.
  440. .IP printAt: 1i
  441. This message is accepted by instances of class String.  The argument must
  442. be a point, representing a line@column pair.  The string is printed at the
  443. point.
  444. In addition, there is a class \fBForm\fP found in /prelude, which is an
  445. attempt at providing simple graphics forms.  Instances of \fBForm\fP also
  446. repond to printAt:.  A sample program plane.st can be found in /tests
  447. illustrating some of the features of forms.
  448. Refer to the Makesfiles in /prelude and /tests for more information.
  449. The second approach uses the plot(3) routines.  On some terminals
  450. (the Tektronix 4014, for example) these routines can be set up to
  451. write directly to the terminal screen, rather than going through a
  452. postprocessing filter.  If such a device is available, the symbol PLOT3
  453. should be defined in parser/env.h, in addition appropriate loader commands
  454. (-l4014, for example) should be added to the symbol LIB in
  455. sources/Makefile.
  456. The functionality so provided is the ability to produce lines, circles and
  457. arcs.  Various classes (Pen, PenSave and Form) for doing this are provided
  458. in the /prelude subdirectory, consult the Makefile for details.
  459. A test program (penshow) is provided in the /tests subdirectory.
  460. Troubleshooting
  461. Here are a few of the problems you might run into, and possible solutions:
  462. The first thing to suspect if you observe strange behavior is the
  463. fastloading feature.  Try running the system with the \-m flag, which will
  464. turn off fastloading.  For example, on the 11/70 fastloading will inhibit
  465. the )i command from working correctly, but no error messages will be
  466. generated.  The appearance of a message such as ``\fIxxx\fP: is not
  467. an identifier'', or of can't happen message number 23
  468. is also a clue that fastloading does not work and should be disabled.
  469. Similarly, the appearance of the message ``no such context as:
  470. \fIxxx\fP/stdsave'' during startup is an indication that the file
  471. containing the saved binary form of the standard prelude either does not
  472. exist or is unreadable, or that the path given in parser/env.h is wrong.
  473. The appearence of the message ``xxx: not an identifier'' following a fast
  474. load or a )l command may be a sign that the environment pointer is being
  475. trashed.   Try defining the symbol ENVSAVE and recreating the system.
  476. Solutions to problems with fastloading are to try to
  477. to recreate the stdsave file in /prelude, or as a last resort to remove the
  478. definition for FASTDEFAULT from /parser/env.h, ``make clean''
  479. and recompile everything.
  480. This latter step will configure a system that will not attempt fastloading
  481. unless explicitly called for.
  482. If the function _gamma is undefined following load for st.  Solution: remove
  483. the definition for the symbol GAMMA, ``make clean'' and recompile.
  484. \&``Cant't happen number 1''.  If you are running on a machine with small
  485. memory, your program creates too many objects and runs out of memory.  If
  486. you are running on a vax or other large machine - your application is
  487. creating cycles or many many objects, probably a programming error.
  488. No output appears when you start the program, and if you type control-D all
  489. the output appears.  Solution: define the symbol FLUSHREQ and recompile.
  490. Can't happen number 22 - either TEMPFILE is unreadable, or
  491. /prelude/standard does not exist.
  492. Systems that have trouble with long lines may have difficulty with the file
  493. syms.c in /sources (there is one line in that file over 300 characters long).
  494. If necessary, this file can (and will be) automatically reconstructed from
  495. other files in the directory.
  496. Receiving error number 129 whenever any non-primitive class method is
  497. called may be a symptom of a clash of variable names.  On older systems the
  498. variables runningProcess and runningInterpreter would clash on systems that
  499. did not support long variable names.  The variable runningInterpreter (in
  500. process.c) has since been changed to presentInterpreter, so this problem
  501. should not occur in software taken from more recent distribution tapes.
  502. 129 errors can also be caused by bad preludes.  Try removing all the .p
  503. files from /prelude and remaking standard.
  504. (Frequently, if you receive an error when first building the prelude, some
  505. of the .p files will be incorrect).
  506. Note that /sources and /prelude have make instructions ``make clean'' which
  507. remove object files and are useful in insuring the files are in a clean
  508. state before starting a reconstruction of the system.
  509. Further Distribution
  510. The Little Smalltalk system is public domain, and may be distributed
  511. further as long as proper attribution is given in all published references.
  512. In the interests of keeping the distribution up to date and as error free
  513. as possible, we wish to keep track of known sites using the
  514. system.  People interested in being placed on the mailing list for future
  515. bug announcements and new version announcements should contact Professor
  516. Budd, at the address listed below.  Changes, modifications, or improvements
  517. to the code or the standard library can be submitted also, and will be
  518. considered for inclusion in future distributions.
  519. What to do with BUGS
  520. Observed irregularities in Little Smalltalk behavior during execution
  521. (hereafter known as ``Bugs'') should be reported to:
  522. .DS I
  523. Professor Tim Budd
  524. Little Smalltalk Distribution
  525. Department of Computer Science
  526. Oregon State University
  527. Corvallis, Oregon 97331 USA
  528. CSNET address:  budd@oregon-state.csnet
  529. UUCP  address:  budd@orstcs.uucp
  530. The report of the bug should indicate whether it is reproducible, and if so
  531. how it is manifested.  If it is available, a description of the fix for the
  532. bug should be given, and it will be incorporated into future distributions.
  533. Periodically, a listing of known bug fixes will be mailed to known sites.
  534. The Little Smalltalk system is distributed without responsibility for the
  535. performance of the system and without any guarantee of maintenance.
  536. echo unbundling userman 1>&2
  537. cat >userman <<'End'
  538. .ds CM
  539. A Little Smalltalk
  540. User Manual
  541. Timothy A. Budd
  542. .po +0.2i
  543. .nr PO +0.2i
  544. .NH 1
  545. Introduction
  546. This manual is intended as an aid in using the Little Smalltalk system.
  547. It is not intended to be used as an introduction to the Smalltalk
  548. language.
  549. Little Smalltalk is largely (with exceptions listed in a later section)
  550. a subset of the Smalltalk-80\s-2\u*\d\s+2 language described
  551. * Smalltalk-80 is a trademark of the Xerox Corporation.
  552. in [.Smalltalk blue.].
  553. A complete description of the classes included in the Little Smalltalk system
  554. and the messages they accept is given in Appendix 1.
  555. .NH 1
  556. Running the system
  557. The Little Smalltalk system is invoked by typing the command \fBst\fP.
  558. The system is interactive \- that is, the user types an expression at the
  559. keyboard and the system responds by evaluating the expression and typing
  560. the result.
  561. For example,
  562. typing the expression \fB3 + 4\fP results in the value \fB7\fP being
  563. displayed on
  564. the output.  Execution is terminated by typing control\-D.  A sample
  565. execution session is shown in Figure 1.
  566. .DS B
  567. Little Smalltalk
  568.     3 + 4
  569. \fBFigure 1:\fP A Sample Little Smalltalk Session
  570. Instance variables for the command level can be created by
  571. assigning a value to a new variable name.  Thereafter that variable can
  572. be used at the command level, although it is not known within the scope
  573. of any method.  The variable ``last'' always contains the value
  574. returned by the last expression typed.
  575. Figure 2 shows the creation of a variable.
  576. Note that the assignment arrow is formed as a two character sequence.
  577. .DS B
  578. .ta 5m
  579.     newvar <\(mi 2 / 3
  580.     newvar
  581. 0.666667
  582.     2 raisedTo: newvar + (4 / 3)
  583.     last
  584. \fBFigure 2:\fP Creating Variables
  585. The default behavior is for the value of expressions,
  586. with the exception of assignments, to be typed
  587. automatically as they are evaluated.
  588. This behavior can be modified either by using the \-d flag
  589. (see Appendix 2), or by passing a message to the pseudo
  590. variable \fBsmalltalk\fP (see Appendix 1).
  591. Class descriptions must be read in from files, they cannot be entered
  592. interactively.  Class descriptions are entered using a system directive.
  593. For example, to include a class description contained in a file named
  594. \fBnewclass.st\fP, the following system directive should be issued:
  595. )i newclass.st
  596. A list of files containing class descriptions can also be given as
  597. arguments to the st command.  The command
  598. .DS B
  599. %st file\s-2\d1\u\s+2 ... file\s-2\dn\u\s+2
  600. is equivalent to the sequence
  601. .DS B
  602. .ta 5m
  603. Little Smalltalk
  604.     )i file\s-2\d1\u\s+2
  605.     )i file\s-2\dn\u\s+2
  606. A table of system directives is given in Figure 3.
  607. center box;
  608. l lw(4.5i).
  609. )e filename    T{
  610. Edit the named file.  The Little Smalltalk system will suspend, leaving
  611. the user in an editor for making changes to the named file.  Upon leaving
  612. the editor the named file will automatically be included, as if the )i
  613. directive had been typed.
  614. )g filename    T{
  615. Search for an entry in the system library area matching the filename.
  616. If found, the class descriptions in the library entry are included.
  617. This command is useful for including commonly used classes that are not
  618. part of the standard prelude, such as classes for statistics applications
  619. or graphics.
  620. )i filename    T{
  621. Include the named file.  The file must contain one or more class descriptions.
  622. The class descriptions are parsed, and if syntactically legal new
  623. instances of class \fBClass\fP are added to the Smalltalk system.
  624. )l filename    T{
  625. Load a previously saved environment from the named file.
  626. The current values of all variables are overridden.
  627. The file must have been created using the )s directive (below).
  628. )r filename    T{
  629. Read the named file.  The file must contain Smalltalk statements, as
  630. would be typed at the keyboard.  The effect is just as if the lines
  631. of the file had been typed at the keyboard.  The file cannot contain
  632. class descriptions.
  633. )s filename    T{
  634. Save the current state in the named file.  The values of all variables
  635. are saved, and can later be reloaded using the )l directive (above).
  636. )!string    T{
  637. Execute the remainder of the line following the exclamation point
  638. as a Unix\s-2\u*\d\s+2 command.  Nothing is done with the output of the command,
  639. nor is the returning status of the command recorded.
  640. \fBFigure 3:\fP System Directives
  641. Note that the )e system directive invokes an editor on a file
  642. containing class descriptions, and then automatically includes the file
  643. when the editor is exited.
  644. Classes also respond to the message \fBedit\fP, which will have the same
  645. effect as the )e directive applied to the file containing the class
  646. description.
  647. Thus the typical debug/edit/debug cycle
  648. involves repeated uses of the )e directive or the \fBedit\fP message
  649. until a desired outcome is achieved.
  650. The editor invoked by the )e directive can be changed by setting
  651. the EDITOR variable in the users environment.
  652. .NH 1
  653. Differences between Little Smalltalk and the Smalltalk-80 system
  654. This section describes the differences between the language accepted by
  655. the Little Smalltalk system and the language described in
  656. [.Smalltalk blue.].  The principal reasons for these changes are
  657. as follows:
  658. .IP size 6.5m
  659. Classes which are largely unnecessary, or which could be easily
  660. simulated by other classes (e.g. Association, SortedCollection) have
  661. been eliminated in the interest of keeping the size of the standard
  662. library as small as possible.  Similarly, indexed instance variables are
  663. not supported, since to do so would increase the size of every object in
  664. the system, and they can be easily simulated in those classes in which
  665. they are important (see below).
  666. .IP portability
  667. Classes which depend upon particular hardware (e.g. BitBlt) are not included
  668. as part of the Little Smalltalk system.  The basic system assumes nothing
  669. more than ascii terminals.
  670. .IP representation
  671. The need for a textual representation for class descriptions required some
  672. small additions to the syntax for class methods (see Appendix 3).
  673. Similarly, the fact that classes and subclasses can be separately parsed,
  674. in either order, forced some changes in the scoping rules for instance
  675. variables.
  676. The following sections describe these changes in more detail.
  677. .NH 2
  678. No Browser
  679. The Smalltalk-80 Programming Environment described in [.Smalltalk orange.]
  680. is not included as part of the Little Smalltalk system.  The Little
  681. Smalltalk system is designed to be little, easily portable, and to
  682. rely on nothing more than basic terminal capabilities.
  683. .NH 2
  684. Internal Representation Different
  685. The internal representations of objects, including processes, interpreters,
  686. and bytecodes, is entirely different in the Little Smalltalk system from
  687. the Smalltalk-80 system described in [.Smalltalk blue.].
  688. * Unix is a trademark of Bell Laboratories.
  689. .NH 2
  690. Fewer Classes
  691. Many of the classes described in [.Smalltalk blue.] are not included as
  692. part of the Little Smalltalk basic system.  Some of these are not
  693. necessary because of the decision not to include the editor, browser,
  694. and so on as part of the basic system.  Others are omitted in the interest
  695. of keeping the standard library of classes small.  A complete list
  696. of included classes for the Little Smalltalk system is given in Appendix 1.
  697. .NH 2
  698. No Class Protocol
  699. Protocol for all classes is defined as part of class \fBClass\fP.
  700. It is not possible to redefine class protocol as part of a class description,
  701. only instance protocol.
  702. The notion of metaclasses is not supported.
  703. .NH 2
  704. Cascades Different
  705. The semantics of cascades has been simplified and generalized.
  706. The result of a cascaded expression is always the result of the expression
  707. to the left of the first semicolon, which is also the receiver for each
  708. subsequent continuation.  Continuations can include multiple messages.
  709. A rather nonsensical, but illustrative, example is the following:
  710. .DS B
  711. 2 + 3 ; \(mi 7 + 3 ; * 4
  712. The result of this expression is 5 (the value yielded by 2 + 3).  5 is also
  713. the receiver for the message \(mi 7, and that result (\(mi2) is in turn the
  714. receiver for the message + 3.  This last result is thrown away.  5 is then
  715. again used as the receiver for the message * 4, the result of which is also
  716. thrown away.
  717. .NH 2
  718. Instance Variable Name Scope
  719. In the language described in [.Smalltalk blue.], an instance variable is
  720. known not only to the class protocol in which it is declared, but is also
  721. valid in methods defined for any subclasses of that class.
  722. In the Little Smalltalk system an instance variable can be referenced only
  723. within the protocol for the class in which it is declared.
  724. .NH 2
  725. Indexed Instance Variables
  726. Implicitly defined indexed instance variables are not supported.
  727. In any class for which these are desired they can be easily simulated by
  728. including an additional instance variable, containing an Array, and
  729. including the following methods:
  730. .DS B
  731. .ta 4m 8m
  732. Class Whatever
  733. | indexVars |
  734.     new: size
  735.         indexVars <\(mi Array new: size
  736. |    at: location
  737.         \(ua indexVars at: location
  738. |    at: location put: value
  739.         indexVars at: location put: value
  740. The message new: can be used with any class, with an effect similar to
  741. new.  That is, if a new instance of the class is created by sending the
  742. message new: to the class variable, the message is immediately passed
  743. on to the new instance, and the result returned is used as the result of
  744. the creation message.
  745. .NH 2
  746. No Pool Variables
  747. The concepts of pool variables, global variables, or class variables are
  748. not supported.
  749. In their place there is a new pseudo-variable, \fBsmalltalk\fP, which
  750. responds to the messages \fBat:\fP and \fBat:put:\fP.
  751. The keys for this collection can be arbitrary.
  752. Although this facility is available, its use is often a sign of poor
  753. program design, and should be avoided.
  754. .NH 2
  755. No Associations
  756. The class Dictionary stores keys and values separately, rather than
  757. as instances of Association.  The class Association, and all messages
  758. referring to Associations have been removed.
  759. .NH 2
  760. Generators in place of Streams
  761. The notion of stream has been replaced by the slightly different notion of
  762. \fIgenerators\fP, in particular the use of the messages \fIfirst\fP
  763. and \fInext\fP in subclasses of \fBCollection\fP.
  764. External files are supported by an explicit class \fBFile\fP.
  765. .NH 2
  766. Primitives Different
  767. Both the syntax and the use of primitives has been changed.
  768. Primitives provide an interface between the Smalltalk world and the
  769. underlying system, permitting the execution of operations that cannot be
  770. specified in Smalltalk.  In Little Smalltalk, primitives cannot fail and
  771. must return a value (although they may, in error situations, print an error
  772. message and return \fBnil\fP).
  773. The syntax for primitives has been altered to permit the specification of
  774. primitives with an arbitrary number of arguments.  The format for a
  775. primitive call is as follows:
  776. .DS B
  777. <primitive \fBnumber\fP \fIargumentlist\fP >
  778. Where \fBnumber\fP is the number of the primitive to be executed
  779. (which must be a value between 1 and 255),
  780. and \fIargumentlist\fP is a list of Smalltalk primary expressions (see
  781. Appendix 2).  Appendix 4 lists the meanings of each of the currently
  782. recognized primitive numbers.
  783. .NH 2
  784. Byte Arrays
  785. A new syntax has been created for defining an array composed entirely of
  786. unsigned integers in the range 0-255.  These arrays are given a very
  787. tight encoding.  The syntax is a pound sign, followed by a left square
  788. brace, followed by a sequence of numbers in the range 0 to 255, followed by
  789. a right square brace.
  790. .DS B
  791. #[ \fInumbers\fP ]
  792. Byte Arrays are used extensively internally.
  793. .NH 2
  794. New Pseudo Variables
  795. In addition to the pseudo variable \fBsmalltalk\fP already mentioned,
  796. another pseudo variable, \fBselfProcess\fP, has beed added to the Little
  797. Smalltalk system.  \fBselfProcess\fP returns the currently executing process,
  798. which can then be passed as an argument to a semaphore, or
  799. be used as a receiver for a message valid for class \fBProcess\fP.
  800. Like \fBself\fP and \fBsuper\fP, \fBselfProcess\fP cannot be used at
  801. the command level.
  802. .NH 2
  803. No Dependency
  804. The notion of dependency, and automatic dependency updating, is not
  805. included in Little Smalltalk.
  806. .ds CH
  807. .ce 2
  808. Appendix 1
  809. Class Descriptions
  810. The messages accepted by the classes included in the Little Smalltalk
  811. standard library are described in the following pages.
  812. A list of the classes
  813. defined, where indentation is used to imply subclassing, is given below:
  814. .DS I
  815. .ta 3m 6m 9m 12m 15m
  816. Object
  817.     UndefinedObject
  818.     Symbol
  819.     Boolean
  820.         True
  821.         False
  822.     Magnitude    
  823.         Char
  824.         Number
  825.             Integer
  826.             Float
  827.         Radian
  828.         Point
  829.     Random
  830.     Collection
  831.         Bag
  832.         Set
  833.         KeyedCollection
  834.             Dictionary
  835.                 Smalltalk
  836.             File
  837.             SequenceableCollection
  838.                 Interval
  839.                 LinkedList
  840.                     Semaphore
  841.                 File
  842.                 ArrayedCollection
  843.                     Array
  844.                     ByteArray
  845.                     String
  846.     Block
  847.     Class
  848.     Process
  849. In the descriptions of each message the following notes may occur:
  850. .IP \fId\fP
  851. Indicates the effect of the message differs slightly from that given
  852. in [.Smalltalk blue.].
  853. .IP \fIn\fP
  854. Indicates the message is not included as part of the language defined
  855. in [.Smalltalk blue.].
  856. .IP \fIr\fP
  857. Indicates the protocol for the message overrides a protocol given in
  858. some superclass.  Only where the logical effect of this overriding is
  859. important is the message given a second time; some messages, such as
  860. copy, are overridden in many classes but are not described in the documentation
  861. because the logical effect remains the same.
  862. .ce 2
  863. Appendix 2
  864. Man Page
  865. A Unix man page for the st command is given on the following page.
  866. .ce 2
  867. Appendix 3
  868. Syntax Charts
  869. Syntax charts for the language accepted by the Little Smalltalk system
  870. are described on the following pages.
  871. The following is an example class description:
  872. .DS B
  873. Class Set :Collection
  874. | dict |
  875.         new
  876.                 dict <\(mi Dictionary new
  877. |       add: newElement
  878.                 dict at: newElement
  879.                      ifAbsent: [dict at: newElement put: 1]
  880. |       remove: oldElement ifAbsent: exceptionBlock
  881.         dict removeKey: oldElement ifAbsent: exceptionBlock
  882. |       size
  883.                 \(ua dict size
  884. |       occurrencesOf: anElement
  885.                 \(ua dict at: anElement ifAbsent: [0]
  886. |       first
  887.                 dict first.
  888.         \(ua dict currentKey
  889. |       next
  890.                 dict next.
  891.         \(ua dict currentKey
  892. .ce 2
  893. Appendix 4
  894. Primitive Numbers
  895. The following chart gives the function performed by each primitive in the
  896. Little Smalltalk system.
  897. Information about objects
  898. .IP 0
  899. (not used )
  900. .IP 1
  901. class of an object
  902. .IP 2
  903. superobject of an object
  904. .IP 3
  905. test if class responds to new
  906. .IP 4
  907. size of object
  908. .IP 5
  909. hash value
  910. .IP 6
  911. test if two built-in objects are of the same type
  912. .IP 7
  913. object equality testing ( == )
  914. .IP 8
  915. various switch toggles
  916. .IP 9
  917. numerical generality testing
  918. Integer manipulation
  919. .IP 10
  920. integer addition (both args must be integer)
  921. .IP 11
  922. integer subtraction
  923. .IP 12
  924. integer < test
  925. .IP 13
  926. integer > test
  927. .IP 14
  928. integer \(<= test
  929. .IP 15
  930. integer \(>= test
  931. .IP 16
  932. integer = test
  933. .IP 17
  934. integer ~= test
  935. .IP 18
  936. integer multiplication
  937. .IP 19
  938. integer //
  939. Bit manipulation and other integer valued functions
  940. .IP 20
  941. .IP 21
  942. bitAt:
  943. .IP 22
  944. bitOr:
  945. .IP 23
  946. bitAnd:
  947. .IP 24
  948. bitXor:
  949. .IP 25
  950. bitShift:
  951. .IP 26
  952. radix:
  953. .IP 27
  954. not used
  955. .IP 28
  956. integer quo:
  957. .IP 29
  958. integer rem:
  959. Other integer functions
  960. .IP 30
  961. doPrimitive:withArguments:
  962. .IP 31
  963. not used
  964. .IP 32
  965. convert random integer to random float
  966. .IP 33
  967. bitInvert
  968. .IP 34
  969. highBit
  970. .IP 35
  971. randomNumber (argument is seed )
  972. .IP 36
  973. asCharacter
  974. .IP 37
  975. asString
  976. .IP 38
  977. factorial
  978. .IP 39
  979. asFloat
  980. Character manipulation
  981. .IP 40
  982. not used
  983. .IP 41.
  984. not used
  985. .IP 42
  986. character < test
  987. .IP 43
  988. character > test
  989. .IP 44
  990. character \(<= test
  991. .IP 45
  992. character \(>= test
  993. .IP 46
  994. character = test
  995. .IP 47
  996. character ~= test
  997. .IP 48
  998. not used
  999. .IP 49
  1000. not used
  1001. Character unary functions
  1002. .IP 50
  1003. digitValue
  1004. .IP 51
  1005. isVowel
  1006. .IP 52
  1007. isLetter
  1008. .IP 53
  1009. isLowerCase
  1010. .IP 54
  1011. isUpperCase
  1012. .IP 55
  1013. isSeparator
  1014. .IP 56
  1015. isAlphaNumeric
  1016. .IP 57
  1017. caseShift
  1018. .IP 58
  1019. asString
  1020. .IP 59
  1021. asciiValue
  1022. Floating point manipulation
  1023. .IP 60
  1024. floating point addition (both args must be float)
  1025. .IP 61
  1026. floating point subtraction
  1027. .IP 62
  1028. floating point < test
  1029. .IP 63
  1030. floating point > test
  1031. .IP 64
  1032. floating point \(<= test
  1033. .IP 65
  1034. floating point \(>= test
  1035. .IP 66
  1036. floating point = test
  1037. .IP 67
  1038. floating point ~= test
  1039. .IP 68
  1040. floating point multiplication
  1041. .IP 69
  1042. floating point division
  1043. Other floating point operations
  1044. .IP 70
  1045. .IP 71
  1046. .IP 72
  1047. floor
  1048. .IP 73
  1049. ceiling
  1050. .IP 74
  1051. not used
  1052. .IP 75
  1053. integerPart
  1054. .IP 76
  1055. fractionalPart
  1056. .IP 77
  1057. gamma
  1058. .IP 78
  1059. asString
  1060. .IP 79
  1061. Other numerical functions
  1062. .IP 80
  1063. normalize number to be within 0 and 2\(*p.
  1064. .IP 81
  1065. .IP 82
  1066. .IP 83
  1067. not used
  1068. .IP 84
  1069. arcSin
  1070. .IP 85
  1071. arcCos
  1072. .IP 86
  1073. arcTan
  1074. .IP 87
  1075. not used
  1076. .IP 88
  1077. raisedTo:
  1078. .IP 89
  1079. radix:
  1080. Symbol Commands
  1081. .IP 90.
  1082. not used
  1083. .IP 91
  1084. symbol comparison, returns true or false.
  1085. .IP 92
  1086. printString
  1087. .IP 93
  1088. asString
  1089. .IP 94
  1090. print (used internally)
  1091. .IP 95
  1092. not used
  1093. .IP 96
  1094. not used
  1095. .IP 97
  1096. build a new class, arguments are class name, superclass name, instance
  1097. variables, messages, methods, context size.
  1098. .IP 98
  1099. insert an object into class dictionary, first argument is symbol,
  1100. second argument is class definition
  1101. .IP 99
  1102. find an object in class dictionary.  argument is symbol.
  1103. String operations
  1104. .IP 100
  1105. string length
  1106. .IP 101
  1107. string compare, case important \- return \(mi1, 0 or 1.
  1108. .IP 102
  1109. string compare, case not important
  1110. .IP 103
  1111. string catenation
  1112. .IP 104
  1113. string at:
  1114. .IP 105
  1115. string at:put:
  1116. .IP 106
  1117. copyFrom:length:
  1118. .IP 107
  1119. copy (new string with same chars)
  1120. .IP 108
  1121. asSymbol
  1122. .IP 109
  1123. string printString
  1124. Array manipulation
  1125. .IP 110
  1126. build an untyped object of given size, argument is integer size.
  1127. .IP 111
  1128. index variable get (first argument is object, second is index)
  1129. .IP 112
  1130. index variable put (first argument is object, second is index,
  1131. third argument is expression)
  1132. .IP 113
  1133. object grow (returns a new object with same instance variable values
  1134. as first argument, but with second argument tacked on end as new instance variable)
  1135. .IP 114
  1136. build an instance of \fBArray\fP of the given size.
  1137. .IP 115
  1138. new string of given size
  1139. .IP 116
  1140. ByteArray new:
  1141. .IP 117
  1142. ByteArray size
  1143. .IP 118
  1144. ByteArray at:
  1145. .IP 119
  1146. ByteArray at:put:
  1147. Output and error messages
  1148. .IP 120
  1149. print string with no return
  1150. .IP 121
  1151. print string with return
  1152. .IP 122
  1153. general error - first argument is receiver, second is error string
  1154. .IP 123
  1155. print string on error output (with return)
  1156. .IP 124
  1157. not used
  1158. .IP 125
  1159. unix system call
  1160. .IP 126
  1161. print a string at a specific point on the terminal
  1162. .IP 127
  1163. block return without surrounding context
  1164. .IP 128
  1165. reference count less than zero, first argument is guilty object
  1166. .IP 129
  1167. does not respond error, first argument is receiver, second is message.
  1168. File operations
  1169. .IP 130
  1170. file open, first argument is name, second argument is mode
  1171. .IP 131
  1172. file read
  1173. .IP 132
  1174. file write
  1175. .IP 133
  1176. set file mode, first argument is file, second is mode indicator (anInteger)
  1177. .IP 134
  1178. compute file size in bytes
  1179. .IP 135
  1180. file set location (at:) second argument is location (anInteger)
  1181. .IP 136
  1182. return current file offset in bytes
  1183. .IP 137
  1184. not used
  1185. .IP 138
  1186. not used
  1187. .IP 139
  1188. not used
  1189. Process management
  1190. .IP 140
  1191. block execute (trapped by interpreter)
  1192. .IP 141
  1193. new process (withArguments:)
  1194. .IP 142
  1195. terminate a process
  1196. .IP 143
  1197. perform:withArguments: (trapped by interpreter)
  1198. .IP 144.
  1199. not used
  1200. .IP 145
  1201. set state
  1202. .IP 146
  1203. return state
  1204. .IP 148
  1205. start atomic action
  1206. .IP 149
  1207. end atomic action
  1208. Operations on classes
  1209. .IP 150
  1210. class edit
  1211. .IP 151
  1212. superclass of a class
  1213. .IP 152
  1214. class name (a Symbol)
  1215. .IP 153
  1216. new instance of a class
  1217. .IP 154
  1218. list all commands class responds to
  1219. .IP 155
  1220. respondsTo: , second argument is a symbol
  1221. .IP 156
  1222. class view (drop into editor, but no include)
  1223. .IP 157
  1224. class list
  1225. .IP 158
  1226. variables (returns an array of symbols)
  1227. .IP 159
  1228. not used
  1229. Date and Time
  1230. .IP 160
  1231. current date and time as string
  1232. .IP 161
  1233. seconds time counter
  1234. .IP 162
  1235. clear the screen
  1236. Plot(3) interface
  1237. .IP 170
  1238. clear the screen
  1239. .IP 171
  1240. move the cursor (move(x,y))
  1241. .IP 172
  1242. draw a line (cont(x,y))
  1243. .IP 173
  1244. draw a point (point(x,y))
  1245. .IP 174
  1246. draw a circle (circle(x,y,r))
  1247. .IP 175
  1248. draw an arc (arc(x,y,x0,y0,x1,y1))
  1249. .IP 176
  1250. establish the coordinate space (space(a,b,c,d))
  1251. .IP 177
  1252. draw a line (line(a,b,c,d))
  1253. .IP 178
  1254. print a label (label(s))
  1255. .IP 179
  1256. establish a line type (linemod(s))
  1257. echo unbundling apndx1 1>&2
  1258. cat >apndx1 <<'End'
  1259. .so macros
  1260. .ds CF
  1261. .ds CH
  1262. .ps +0.2i
  1263. .nr PO +0.2i
  1264. .Nm Object
  1265. The class \fBObject\fP is a superclass of all classes in the system, and is
  1266. used to provide a consistent basic functionality and default behavior.
  1267. Many methods in class \fBObject\fP are overridden in subclasses.
  1268. Responds to
  1269. .Rs ==
  1270. Return true if receiver and argument are the
  1271. same object, false otherwise.
  1272. .Rs ~~
  1273. Inverse of ==.
  1274. .Rs asString
  1275. Return a string representation of the receiver,
  1276. by default this is the same as \fIprintString\fP, although one or the
  1277. other is redefined in many subclasses.
  1278. .Rs asSymbol
  1279. Return a symbol representing the receiver.
  1280. .Rs class
  1281. Return object representing the class of the receiver.
  1282. .Rs copy
  1283. Return shallowCopy of receiver.
  1284. Many subclasses redefine shallowCopy.
  1285. .Rs deepCopy
  1286. Return the receiver.  This method is redefined in many sub\%classes.
  1287. .Rs do: d
  1288. The argument must be a one argument block.
  1289. Execute the block on every element of the receiver collection.
  1290. Elements in the receiver collection are listed using \fIfirst\fP and \fInext\fP
  1291. (below), so the default behavior is merely to execute the block using the
  1292. receiver as argument.
  1293. .Rs error:
  1294. Argument must be a String.  Print argument string as error message.
  1295. Return \fBnil\fP.
  1296. .Rs first n
  1297. Return first item in sequence, which is by default simply the receiver.
  1298. See \fInext\fP, below.
  1299. .Rs isKindOf:
  1300. Argument must be a \fBClass\fP.  Return true if class of receiver, or any
  1301. superclass thereof, is the same as argument.
  1302. .Rs isMemberOf:
  1303. Argument must be a \fBClass\fP.  Return true if receiver is instance of
  1304. argument class.
  1305. .Rs isNil
  1306. Test whether receiver is object \fBnil\fP.
  1307. .Rs next n
  1308. Return next item in sequence, which is by default \fBnil\fP.  This message is
  1309. redefined in classes which represent sequences, such as \fBArray\fP
  1310. or \fBDictionary\fP.
  1311. .Rs notNil
  1312. Test if receiver is not object \fBnil\fP.
  1313. .Rs print
  1314. Display print image of receiver on the standard output.
  1315. .Rs printString
  1316. Return a string representation of receiver.
  1317. Objects which do not redefine printString, and which therefore do not have
  1318. a printable representation, return their class name as a string.
  1319. .Rs respondsTo:
  1320. Argument must be a symbol.  Return true if receiver will respond to
  1321. the indicated message.
  1322. .Rs shallowCopy
  1323. Return the receiver.  This method is redefined in many sub\%classes.
  1324. 7 ~~ 7.0    True
  1325. 7 asSymbol    #7
  1326. 7 class    Integer
  1327. 7 copy    7
  1328. 7 isKindOf: Number    True
  1329. 7 isMemberOf: Number    False
  1330. 7 isNil    False
  1331. 7 respondsTo: #+    True
  1332. .Nm Object UndefinedObject
  1333. The pseudo variable \fBnil\fP is an instance (usually the only instance) of the
  1334. class \fBUndefinedObject\fP.  \fBnil\fP is used to represent undefined values,
  1335. and is
  1336. also typically returned in error situations.  \fBnil\fP is also used as a terminator
  1337. in sequences, as for example in response to the message \fInext\fP when there are
  1338. no further elements in a sequence.
  1339. Responds to
  1340. .Rs isNil r
  1341. Overrides method found in Object.  Return true.
  1342. .Rs notNil r
  1343. Overrides method found in Object.  Return false.
  1344. .Rs printString r
  1345. Return 'nil'.
  1346. nil isNil    True
  1347. .Nm Object Symbol
  1348. Instances of the class \fBSymbol\fP are created either by their literal
  1349. representation, which is a pound sign followed by a string of nonspace
  1350. characters (for example #aSymbol ),
  1351. or by the message \fIasSymbol\fP being passed to an object.
  1352. Symbols cannot be created using \fInew\fP.  Symbols are guaranteed to have
  1353. unique representations; that is, two symbols representing the same
  1354. characters will always test equal to each other.  Inside of literal
  1355. arrays, the leading pound signs on symbols can be eliminated, for example:
  1356. #(these are symbols).
  1357. Responds to
  1358. .Rs == r
  1359. Return true if the two symbols represent the same characters,
  1360. false otherwise.
  1361. .Rs asString r
  1362. Return a String representation of the symbol without the leading pound
  1363. sign.
  1364. .Rs printString r
  1365. Return a String representation of the symbol, including the leading pound
  1366. sign.
  1367. #abc == #abc    True
  1368. #abc == #ABC    False
  1369. #abc ~~ #ABC    True
  1370. #abc printString    #abc
  1371. \&'abc' asSymbol    #abc
  1372. .Nm Object Boolean
  1373. The class \fBBoolean\fP provides protocol for manipulating true and false values.
  1374. The pseudo variables \fBtrue\fP and \fBfalse\fP are instances of the subclasses of
  1375. \fBBoolean\fP; \fBTrue\fP and \fBFalse\fP, respectively.
  1376. The subclasses \fBTrue\fP and \fBFalse\fP, in combination with blocks, are used to
  1377. implement conditional control structures.  Note, however, that the
  1378. bytecodes may optimize conditional tests by generating
  1379. code in-line, rather than using message passing.
  1380. Note that bit-wise boolean operations are provided by class \fBInteger\fP.
  1381. Responds To
  1382. .Rs &
  1383. The argument must be a boolean.  Return the logical conjunction (and)
  1384. of the two values.
  1385. .Rs |
  1386. The argument must be a boolean.  Return the logical disjunction (or)
  1387. of the two values.
  1388. .Rs and:
  1389. The argument must be a block.  Return the logical conjunction (and)
  1390. of the two values.  If the receiver is false the second argument is not
  1391. used, otherwise the result is the value yielded in evaluating the argument
  1392. block.
  1393. .Rs or:
  1394. The argument must be a block.  Return the logical disjunction (or)
  1395. of the two values.  If the receiver is true the second argument is not
  1396. used, otherwise the result is the value yielded in evaluating the argument
  1397. block.
  1398. .Rs eqv:
  1399. The argument must be a boolean.  Return the logical equivalence (eqv)
  1400. of the two values.
  1401. .Rs xor:
  1402. The argument must be a boolean.  Return the logical exclusive or (xor)
  1403. of the two values.
  1404. (1 > 3) & (2 < 4)    False
  1405. (1 > 3) | (2 < 4)    True
  1406. (1 > 3) and: [2 < 4]    False
  1407. .Nm Object Boolean True
  1408. The pseudo variable \fBtrue\fP is an instance (usually the only instance) of
  1409. the class \fBTrue\fP.
  1410. Responds To
  1411. .Rs ifTrue:
  1412. Return the result of evaluating the argument block.
  1413. .Rs ifFalse:
  1414. Return \fBnil\fP.
  1415. .Rs ifTrue:ifFalse:
  1416. Return the result of evaluating the first argument block.
  1417. .Rs ifFalse:ifTrue:
  1418. Return the result of evaluating the second argument block.
  1419. .Rs not
  1420. Return \fBfalse\fP.
  1421. (3 < 5) not    False
  1422. (3 < 5) ifTrue: [17]    17
  1423. .Nm Object Boolean False
  1424. The pseudo variable \fBfalse\fP is an instance (usually the only instance) of
  1425. the class \fBFalse\fP.
  1426. .Rs ifTrue:
  1427. Return \fBnil\fP.
  1428. .Rs ifFalse:
  1429. Return the result of evaluating the argument block.
  1430. .Rs ifTrue:ifFalse:
  1431. Return the result of evaluating the second argument block.
  1432. .Rs ifFalse:ifTrue:
  1433. Return the result of evaluating the first argument block.
  1434. .Rs not
  1435. Return \fBtrue\fP.
  1436. (1 < 3) ifTrue: [17]    17
  1437. (1 < 3) ifFalse: [17]    nil
  1438. .Nm Object Magnitude
  1439. The class \fBMagnitude\fP provides protocol for those subclasses possessing
  1440. a linear ordering.  For the sake of efficiency, most subclasses redefine
  1441. some or all of the relational messages.  All methods are defined in
  1442. terms of the basic messages <, = and >, which are in turn defined
  1443. circularly in terms of each other.  Thus each subclass of \fBMagnitude\fP
  1444. must redefine at least one of these messages.
  1445. .Rs <
  1446. Relational less than test.  Returns a boolean.
  1447. .Rs <=
  1448. Relational less than or equal test.
  1449. .Rs =
  1450. Relational equal test.  Note that this differs from ==, which is
  1451. an object equality test.
  1452. .Rs ~=
  1453. Relational not equal test, opposite of =.
  1454. .Rs >=
  1455. Relational greater than or equal test.
  1456. .Rs >
  1457. Relational greater than test.
  1458. .Rs between:and:
  1459. Relational test for inclusion.
  1460. .Rs max:
  1461. Return the maximum of the receiver and argument value.
  1462. .Rs min:
  1463. Return the minimum of the receiver and argument value.
  1464. $A max: $a    $a
  1465. 4 between: 3.1 and: (17/3)    True
  1466. .Nm Object Magnitude Char
  1467. This class defines protocol for objects with character values.
  1468. Characters possess an ordering given by the underlying representation,
  1469. however arithmetic is not defined for character values.
  1470. Characters are written literally by preceding the character desired with
  1471. a dollar sign, for example: $a \0 $B \0 $$.
  1472. Responds to
  1473. .Rs == r
  1474. Object equality test.  Two instances of the same character always test equal.
  1475. .Rs asciiValue
  1476. Return an \fBInteger\fP representing the ascii value of the receiver.
  1477. .Rs asLowercase
  1478. If the receiver is an uppercase letter returns the same letter in lowercase,
  1479. otherwise returns the receiver.
  1480. .Rs asUppercase
  1481. If the receiver is a lowercase letter returns the same letter in uppercase,
  1482. otherwise returns the receiver.
  1483. .Rs asString r
  1484. Return a length one string containing the receiver.
  1485. Does not contain leading dollar sign, compare to \fIprintString\fP.
  1486. .Rs digitValue
  1487. If the receiver represents a number (for example $9) return the digit value
  1488. of the number.  If the receiver is an uppercase letter (for example $B) return
  1489. the position of the number in the uppercase letters + 10, ($B returns 11, for
  1490. example).  If the receiver is neither a digit nor an uppercase letter an
  1491. error is given and \fBnil\fP returned.
  1492. .Rs isAlphaNumeric
  1493. Respond true if receiver is either digit or letter, false otherwise.
  1494. .Rs isDigit
  1495. Respond true if receiver is a digit, false otherwise.
  1496. .Rs isLetter
  1497. Respond true if receiver is a letter, false otherwise.
  1498. .Rs isLowercase
  1499. Respond true if receiver is a lowercase letter, false otherwise.
  1500. .Rs isSeparator
  1501. Respond true if receiver is a space, tab or newline, false otherwise.
  1502. .Rs isUppercase
  1503. Respond true if receiver is an uppercase letter, false otherwise.
  1504. .Rs isVowel
  1505. Respond true if receiver is $a, $e, $i, $o or $u, in either
  1506. upper or lower case.
  1507. .Rs printString r    
  1508. Respond with a string representation of the character value.
  1509. Includes leading dollar sign, compare to \fIasString\fP, which does not include $.
  1510. $A < $0    False
  1511. $A asciiValue    65
  1512. $A asString    A
  1513. $A printString    $A
  1514. $A isVowel    True
  1515. $A digitValue    10
  1516. .Nm Object Magnitude Number
  1517. The class \fBNumber\fP is an abstract superclass for \fBInteger\fP and \fBFloat\fP.
  1518. Instances of \fBNumber\fP cannot be created directly.
  1519. Relational messages and many arithmetic messages are redefined in each
  1520. subclass for arguments of the appropriate type.  In general, an error message
  1521. is given and \fBnil\fP returned for illegal arguments.
  1522. Responds To
  1523. .Rs +
  1524. Mixed type addition.
  1525. .Rs \(mi
  1526. Mixed type subtraction.
  1527. .Rs *
  1528. Mixed type multiplication
  1529. .Rs /
  1530. Mixed type division.
  1531. .Rs \(ua n
  1532. Exponentiation, same as raisedTo: .
  1533. .Rs @
  1534. Construct a point with coordinates being the receiver and the argument.
  1535. .Rs abs
  1536. Absolute value of the receiver.
  1537. .Rs exp
  1538. e raised to the power.
  1539. .Rs gamma n
  1540. Return the gamma function (generalized factorial) evaluated at the
  1541. receiver.
  1542. .Rs ln
  1543. Natural logarithm of the receiver.
  1544. .Rs log:
  1545. Logarithm in the given base.
  1546. .Rs negated
  1547. The arithmetic inverse of the receiver.
  1548. .Rs negative
  1549. True if the receiver is negative.
  1550. .Rs pi n
  1551. Return the approximate value of the receiver multiplied by \*(p (3.1415926...).
  1552. .Rs positive
  1553. True if the receiver is positive.
  1554. .Rs radians n
  1555. Argument converted into radians.
  1556. .Rs raisedTo:
  1557. The receiver raised to the argument value.
  1558. .Rs reciprocal
  1559. The arithmetic reciprocal of the receiver.
  1560. .Rs roundTo:
  1561. The receiver rounded to units of the argument.
  1562. .Rs sign
  1563. Return \(mi1, 0 or 1 depending upon whether the receiver is negative, zero or
  1564. positive.
  1565. .Rs sqrt
  1566. Square root.  nil if receiver is less than zero.
  1567. .Rs squared
  1568. Return the receiver multiplied by itself.
  1569. .Rs strictlyPositive
  1570. True if the receiver is greater than zero.
  1571. .Rs to:
  1572. Interval from receiver to argument value with step of 1.
  1573. .Rs to:by:
  1574. Interval from receiver to argument in given steps.
  1575. .Rs truncatedTo:
  1576. The receiver truncated to units of the argument.
  1577. 3 < 4.1    True
  1578. 3 + 4.1    7.1
  1579. 3.14159 exp    23.1406
  1580. 9 gamma    40320
  1581. 5 reciprocal    0.2
  1582. 0.5 radians    0.5 radians
  1583. 13 roundTo: 5    15
  1584. 13 truncateTo: 5    10
  1585. .Nm Object Magnitude Number Integer
  1586. The class \fBInteger\fP provides protocol for objects with integer values.
  1587. Responds To
  1588. .Rs == r
  1589. Object equality test.  Two integers representing the same value are
  1590. considered to be the same object.
  1591. .Rs //
  1592. Integer quotient, truncated towards negative infinity (compare to \fIquo:\fP).
  1593. .Rs \e\e
  1594. Integer remainder, truncated towards negative infinity (compare to \fIrem:\fP).
  1595. .Rs allMask:
  1596. Argument must be \fBInteger\fP.  Treating receiver and argument as bit strings,
  1597. return \fBtrue\fP if all bits with 1 value in argument correspond to bits with 1
  1598. values in the receiver.
  1599. .Rs anyMask:
  1600. Argument must be \fBInteger\fP.  Treating receiver and argument as bit strings,
  1601. return true if any bit with 1 value in argument corresponds to a bit with
  1602. 1 value in the receiver.
  1603. .Rs asCharacter
  1604. Return the Char with the same underlying ascii representation as the low
  1605. order eight bits of the receiver.
  1606. .Rs asFloat
  1607. Floating point value with same magnitude as receiver.
  1608. .Rs bitAnd:
  1609. Argument must be \fBInteger\fP.  Treating the receiver and argument as bit strings,
  1610. return logical \fBand\fP of values.
  1611. .Rs bitAt:
  1612. Argument must be \fBInteger\fP greater than 0 and less than underlying word size.
  1613. Treating receiver as a bit string, return the bit value at the given position,
  1614. numbering from low order (or rightmost) position.
  1615. .Rs bitInvert
  1616. Return the receiver with all bit positions inverted.
  1617. .Rs bitOr:
  1618. Return logical \fBor\fP of values.
  1619. .Rs bitShift:
  1620. Treating the receiver as a bit string, shift bit values by amount indicated
  1621. in argument.  Negative values shift right, positive left.
  1622. .Rs bitXor:
  1623. Return logical \fBexclusive-or\fP of values.
  1624. .Rs even
  1625. Return true if receiver is even, false otherwise.
  1626. .Rs factorial
  1627. Return the factorial of the receiver.  Return as Float for large numbers.
  1628. .Rs gcd:
  1629. Argument must be \fBInteger\fP.  Return the greatest common divisor of the
  1630. receiver and argument.
  1631. .Rs highBit
  1632. Return the location of the highest 1 bit in the receiver.
  1633. Return \fBnil\fP for receiver zero.
  1634. .Rs lcm:
  1635. Argument must be \fBInteger\fP.  Return least common multiple of receiver and
  1636. argument.
  1637. .Rs noMask:
  1638. Argument must be \fBInteger\fP.  Treating receiver and argument as bit strings,
  1639. return true if no 1 bit in the argument corresponds to a 1 bit in the receiver.
  1640. .Rs odd
  1641. Return true if receiver is odd, false otherwise.
  1642. .Rs quo:
  1643. Return quotient of receiver divided by argument.
  1644. .Rs radix:
  1645. Return a string representation of the receiver value, printed in the base
  1646. represented by the argument.  Argument value must be less than 36.
  1647. .Rs rem:
  1648. Remainder after receiver is divided by argument value.
  1649. .Rs timesRepeat:
  1650. Repeat argument block the number of times given by the receiver.
  1651. 5 + 4    7
  1652. 5 allMask: 4    True
  1653. 4 allMask: 5    False
  1654. 5 anyMask: 4    True
  1655. 5 bitAnd: 3    1
  1656. 5 bitOr: 3    7
  1657. 5 bitInvert    \(mi6
  1658. 254 radix: 16    16rFE
  1659. \(mi5 // 4    \(mi2
  1660. \(mi5 quo: 4    \(mi1
  1661. \(mi5 \e\e 4    1
  1662. \(mi5 rem: 4    \(mi1
  1663. 8 factorial    40320
  1664. .Nm Object Magnitude Number Float
  1665. The class \fBFloat\fP provides protocol for objects with floating point values.
  1666. Responds To
  1667. .Rs == r
  1668. Object equality test.  Return true if the receiver and argument
  1669. represent the same floating point value.
  1670. .Rs \(ua n
  1671. Floating exponentiation.
  1672. .Rs arcCos
  1673. Return a \fBRadian\fP representing the arcCos of the receiver.
  1674. .Rs arcSin
  1675. Return a \fBRadian\fP representing the arcSin of the receiver.
  1676. .Rs arcTan
  1677. Return a \fBRadian\fP representing the arcTan of the receiver.
  1678. .Rs  asFloat
  1679. Return the receiver.
  1680. .Rs ceiling
  1681. Return the Integer ceiling of the receiver.
  1682. .Rs coerce:
  1683. Coerce the argument into being type Float.
  1684. .Rs exp
  1685. Return e raised to the receiver value.
  1686. .Rs floor
  1687. Return the Integer floor of the receiver.
  1688. .Rs fractionPart
  1689. Return the fractional part of the receiver.
  1690. .Rs gamma n
  1691. Return the value of the gamma function applied to the receiver value.
  1692. .Rs integerPart
  1693. Return the integer part of the receiver.
  1694. .Rs ln
  1695. Return the natural log of the receiver.
  1696. .Rs radix:
  1697. Return a string containing the printable representation of the receiver
  1698. in the given radix.  Argument must be an Integer less than 36.
  1699. .Rs rounded
  1700. Return the receiver rounded to the nearest integer.
  1701. .Rs sqrt
  1702. Return the square root of the receiver.
  1703. .Rs truncated
  1704. Return the receiver truncated to the nearest integer.
  1705. 4.2 * 3    12.6
  1706. 2.1 \(ua 4    19.4481
  1707. 2.1 raisedTo: 4    19.4481
  1708. 0.5 arcSin    0.523599 radians
  1709. 2.1 reciprocal    0.47619
  1710. 4.3 sqrt    2.07364
  1711. .Nm Object Magnitude Radian
  1712. The class \fBRadian\fP is used to represent radians.  Radians are a unit of
  1713. measurement, independent of other numbers.
  1714. Only radians will responds to the trigonometric functions
  1715. such as \fIsin\fP and \fIcos\fP.
  1716. Numbers can be converted into
  1717. radians by passing them the message \fIradians\fP.  Similarly, radians
  1718. can be converted into numbers by sending them the message \fIasFloat\fP.
  1719. Notice that only a limited range of arithmetic operations are permitted on
  1720. Radians.
  1721. Radians are normalized to be between 0 and 2\(*p.
  1722. Responds to
  1723. .Rs +
  1724. Argument must be a Radian.  Add the two radians together and return the
  1725. normalized result.
  1726. .Rs \(mi
  1727. Argument must be a Radian.  Subtract the argument from the receiver and
  1728. return the normalized result.
  1729. .Rs *
  1730. Argument must be a Number.  Multiply the receiver by the argument amount
  1731. and return the normalized result.
  1732. .Rs /
  1733. Argument must be a Number.  Divide the receiver by the argument amount
  1734. and return the normalized result.
  1735. .Rs asFloat
  1736. Return the receiver as a floating point number.
  1737. .Rs cos
  1738. Return a floating point number representing the cosine of the
  1739. receiver.
  1740. .Rs sin
  1741. Return a floating point number representing the sine of the receiver.
  1742. .Rs tan
  1743. Return a floating point number representing the tangent of the receiver.
  1744. 0.5236 radians sin    0.5
  1745. 0.5236 radians cos    0.866025
  1746. 0.5236 radians tan    0.577352
  1747. 0.5 arcSin asFloat    0.523599
  1748. .Nm Object Magnitude Point
  1749. \fBPoint\fPs are used to represent pairs of quantities, such as coordinate
  1750. pairs.
  1751. Responds To
  1752. .Rs <
  1753. True if both values of the receiver are less than the corresponding values
  1754. in the argument.
  1755. .Rs <=
  1756. True if the first value is less than or equal to the corresponding value in
  1757. the argument, and the second value is less than the corresponding value in
  1758. the argument.
  1759. .Rs >=
  1760. True if both values of the receiver are greater than or equal to the
  1761. corresponding values in the argument.
  1762. .Rs *
  1763. Return a new point with coordinates multiplied by the argument value.
  1764. .Rs /
  1765. Return a new point with coordinates divided by the argument value.
  1766. .Rs //
  1767. Return a new point with coordinates divided by the argument value.
  1768. .Rs +
  1769. Return a new point with coordinates offset by the corresponding values in
  1770. the argument.
  1771. .Rs abs
  1772. Return a new point with coordinates having the absolute value of the
  1773. receiver.
  1774. .Rs dist:
  1775. Return the Euclidean distance between the receiver and the argument
  1776. point.
  1777. .Rs max:
  1778. The argument must be a \fBPoint\fP.
  1779. Return the lower right corner of the rectangle defined by the receiver and
  1780. the argument.
  1781. .Rs min:
  1782. The argument must be a \fBPoint\fP.
  1783. Return the upper left corner of the rectangle defined by the receiver and
  1784. the argument.
  1785. .Rs transpose
  1786. Return a new point with coordinates being the transpose of the receiver.
  1787. .Rs x
  1788. Return the first coordinate of the receiver.
  1789. .Rs x:
  1790. Set the first coordinate of the receiver.
  1791. .Rs x:y:
  1792. Sets both coordinates of the receiver.
  1793. .Rs y
  1794. Return the second coordinate of the receiver.
  1795. .Rs y:
  1796. Set the second coordinate of the receiver.
  1797. (10@12) < (11@14)    True
  1798. (10@12) < (11@11)    False
  1799. (10@12) max: (11@11)    11@12
  1800. (10@12) min: (11@11)    10@11
  1801. (10@12) dist: (11@14)    2.23607
  1802. (10@12) transpose    12@10
  1803. .Nm Object Random
  1804. The class \fBRandom\fP provides protocol for random number generation.  Sending
  1805. the message \fInext\fP to an instance of \fBRandom\fP results in a \fBFloat\fP
  1806. between 0.0 and 1.0, randomly distributed.
  1807. By default, the pseudo random sequence is the same for each object in class
  1808. \fBRandom\fP.  This can be altered using the message \fIrandomize\fP.
  1809. Responds To
  1810. .Rs between:and: n
  1811. Return a random number uniformly distributed between the two arguments.
  1812. .Rs first n
  1813. Return a random number between 0.0 and 1.0.
  1814. This message merely provides consistency with protocol for other sequences,
  1815. such as Arrays or Intervals.
  1816. .Rs next
  1817. Return a random number between 0.0 and 1.0.
  1818. .Rs next: d
  1819. Return an \fBArray\fP containing the next n random numbers, where n
  1820. is the argument value.
  1821. .Rs randInteger: n
  1822. The argument must be an integer.  Return a random integer between 1 and the
  1823. value given.
  1824. .Rs randomize n
  1825. Change the pseudo-random number generator seed by a time dependent value.
  1826. i \(<- Random new
  1827. i next    0.759
  1828. i next    0.157
  1829. i next: 3    #( 0.408 0.278 0.547 )
  1830. i randInteger: 12    5
  1831. i between: 4 and: 17.5    10.0
  1832. .Nm Object Collection
  1833. The class \fBCollection\fP provides protocol for groups of objects, such as
  1834. \fBArray\fPs or \fBSet\fPs.
  1835. The different forms of collections are distinguished by several
  1836. characteristics, among them whether the size of the collection is fixed
  1837. or unbounded, the presence or absence of an ordering, and their insertion
  1838. or access method.  For example, an \fBArray\fP is a collection with a
  1839. fixed size and ordering, indexed by integer keys.  A \fBDictionary\fP, on the
  1840. other hand, has no fixed size or ordering, and can be indexed by
  1841. arbitrary elements.  Nevertheless, \fBArrays\fP and \fBDictionarys\fP share many
  1842. features in common, such as their access method (\fIat:\fP and \fPat:put:\fP),
  1843. and the ability to respond to \fIcollect:\fP, \fIselect:\fP, and many other
  1844. messages.
  1845. The table below lists some of the characteristics of several forms of
  1846. collections:
  1847. center box;
  1848. l c c c c c.
  1849. Name    Creation    Size    Ordered?    Insertion    Access
  1850.     Method    fixed?        method    method
  1851. Bag/Set    new    no    no    add:    includes:
  1852. Dictionary    new    no    no    at:put:    at:
  1853. Interval    n to: m    yes    yes    none    at:
  1854. List    new    no    yes    addFirst:    first
  1855.                 addLast:    last
  1856. Array    new:    yes    yes    at:put:    at:
  1857. String    new:    yes    yes    at:put:    at:
  1858. The list below shows messages that are shared in common by all collections.
  1859. Responds to
  1860. .Rs addAll:
  1861. The argument must be a \fBCollection\fP.
  1862. Add all the elements of the argument collection to the receiver collection.
  1863. .Rs asArray
  1864. Return a new collection of type \fBArray\fP containing the elements from
  1865. the receiver collection.  If the receiver was ordered, the elements will
  1866. be in the same order in the new collection, otherwise the elements will
  1867. be in an arbitrary order.
  1868. .Rs asBag
  1869. Return a new collection of type \fBBag\fP containing the elements from
  1870. the receiver collection.
  1871. .Rs asList n
  1872. Return a new collection of type \fBList\fP containing the elements from
  1873. the receiver collection.  If the receiver was ordered, the elements will
  1874. be in the same order in the new collection, otherwise the elements will
  1875. be in an arbitrary order.
  1876. .Rs asSet
  1877. Return a new collection of type \fBSet\fP containing the elements from
  1878. the receiver collection.
  1879. .Rs asString
  1880. Return a new collection of type \fBString\fP containing the elements from the
  1881. receiver collection.  The elements to be included must all be of type
  1882. \fBCharacter\fP.  If the receiver was ordered, the elements will be in the same
  1883. order in the new collection, otherwise the elements will be listed in an
  1884. arbitrary order.
  1885. .Rs coerce:
  1886. The argument must be a collection.
  1887. Return a collection, of the same type as the receiver, containing elements
  1888. from the argument collection.  This message is redefined in most subclasses
  1889. of collection.
  1890. .Rs collect:
  1891. The argument must be a one argument block.
  1892. Return a new collection, like the receiver, containing the result of
  1893. evaluating the argument block on each element of the receiver collection.
  1894. .Rs detect:
  1895. The argument must be a one argument block.
  1896. Return the first element in the receiver collection for which the
  1897. argument block evaluates true.  Report an error and return \fBnil\fP if
  1898. no such element exists.
  1899. Note that in unordered collections (such as \fBBags\fP or \fBDictionarys\fP) the first
  1900. element to be encountered that will satisfy the condition may not be
  1901. easily predictable.
  1902. .Rs detect:ifAbsent:
  1903. Return the first element in the receiver collection for which the
  1904. first argument block evaluates true.  Return the result of evaluating
  1905. the second argument if no such element exists.
  1906. .Rs do:
  1907. The argument must be a one argument block.
  1908. Evaluate the argument block on each element in the receiver collection.
  1909. .Rs includes:
  1910. Return true if the receiver collection contains the argument.
  1911. .Rs inject:into:
  1912. The first argument must be a value, the second a two argument block.
  1913. The second argument is evaluated once for each element in the receiver
  1914. collection, passing as arguments the result of the previous evaluation
  1915. (starting with the first argument) and the element.
  1916. The value returned is the final value generated.
  1917. .Rs isEmpty
  1918. Return true if the receiver collection contains no elements.
  1919. .Rs occurrencesOf:
  1920. Return the number of times the argument occurs in the receiver collection.
  1921. .Rs remove:
  1922. Remove the argument from the receiver collection.  Report an error
  1923. if the element is not contained in the receiver collection.
  1924. .Rs remove:ifAbsent:
  1925. Remove the first argument from the receiver collection.  Evaluate the second
  1926. argument if not present.
  1927. .Rs reject:
  1928. The argument must be a one argument block.
  1929. Return a new collection like the receiver containing all elements for
  1930. which the argument block returns false.
  1931. .Rs select:
  1932. The argument must be a one argument block.
  1933. Return a new collection like the receiver containing all elements for
  1934. which the argument block returns true.
  1935. .Rs size
  1936. Return the number of elements in the receiver collection.
  1937. i \(<- 'abacadabra'
  1938. i size    10
  1939. i asArray    #( $a $b $a $c $a $d $a $b $r $a )
  1940. i asBag    Bag ( $a $a $a $a $a $r $b $b $c $d)
  1941. i asSet    Set ( $a $r $b $c $d )
  1942. i occurrencesOf: $a    5
  1943. i reject: [:x | x isVowel]    bcdbr
  1944. .Nm Object Collection Bag/Set
  1945. \fBBags\fP and \fBSets\fP are each
  1946. unordered collections of elements.
  1947. Elements in the collections do not have keys, but are added and removed
  1948. directly.
  1949. The difference between a \fBBag\fP and a \fBSet\fP is that each element can occur
  1950. any number of times in a \fBBag\fP, whereas only one copy is inserted into
  1951. a \fBSet\fP.
  1952. Responds to
  1953. .Rs add:
  1954. Add the indicated element to the receiver collection.
  1955. .Rs add:withOccurences:
  1956. (\fBBag\fP only) Add the indicated element to the receiver \fBBag\fP the given number
  1957. of times.
  1958. .Rs first n
  1959. Return the first element from the receiver collection.
  1960. As the collection is unordered, the first element
  1961. depends upon certain values in the internal representation, and is
  1962. not guaranteed to be any specific element in the collection.
  1963. .Rs next n
  1964. Return the next element in the collection.
  1965. In conjunction with \fIfirst\fP, this can be used to access each
  1966. element of the collection in turn.
  1967. i \(<- (1 to: 6) asBag    Bag ( 1 2 3 4 5 6 )
  1968. i size    6
  1969. i select: [:x | (x \e\e 2) strictlyPositive]    Bag ( 1 3 5 )
  1970. i collect: [:x | x \e\e 3]    Bag ( 0 0 1 1 2 2 )
  1971. j \(<- ( i collect: [:x | x \e\e 3] ) asSet    Set ( 0 1 2 )
  1972. j size    3
  1973. \fBNote:\fP Since \fBBags\fP and \fBSets\fP are unordered, there is no way to
  1974. establish a mapping between the elements of the Bag i in the example above
  1975. and the corresponding elements in the collection that resulted from the
  1976. message collect: [:x | x \e\e 3].
  1977. .Nm Object Collection KeyedCollection
  1978. The class \fBKeyedCollection\fP provides protocol for collections with keys,
  1979. such as \fBDictionarys\fP and \fBArrays\fP.
  1980. Since each entry in the collection has both a key and value, the
  1981. method \fIadd:\fP is no longer appropriate.  Instead, the method
  1982. \fIat:put:\fP, which provides both a key and a value, must be used.
  1983. Responds to
  1984. .Rs asDictionary
  1985. Return a new collection of type \fBDictionary\fP containing the elements
  1986. from the receiver collection.
  1987. .Rs at:
  1988. Return the item in the receiver collection whose key matches the argument.
  1989. Produces and error message, and returns nil, if no item is currently in
  1990. the receiver collection under the given key.
  1991. .Rs at:ifAbsent:
  1992. Return the element stored in the dictionary under the key given by the
  1993. first argument.  Return the result of evaluating the second argument if
  1994. no such element exists.
  1995. .Rs atAll:put:
  1996. The first argument must be a collection containing keys valid for the
  1997. receiver.  At each location given by a key in the first argument place
  1998. the second argument.
  1999. .Rs binaryDo:
  2000. The argument must be a two argument block.  This message is similar to \fIdo:\fP,
  2001. however both the key and the element value are passed as argument to the
  2002. block.
  2003. .Rs includesKey:
  2004. Return true if the indicated key is valid for the receiver collection.
  2005. .Rs indexOf:
  2006. Return the key value of the first element in the receiver collection matching
  2007. the argument.
  2008. Produces an error message if no such element exists.
  2009. Note that, as with the message \fIdetect:\fP, in unordered collections the
  2010. first element may not be related in any way to the order in which elements
  2011. were placed into the collection, but is rather implementation dependent.
  2012. .Rs indexOf:ifAbsent:
  2013. Return the key value of the first element in the receiver collection matching
  2014. the argument.
  2015. Return the result of evaluating the second argument if no such element
  2016. exists.
  2017. .Rs keys
  2018. Return a Set containing the keys for the receiver collection.
  2019. .Rs keysDo:
  2020. The argument must be a one argument block.
  2021. Similar to \fIdo:\fP, except that the values passed to the block are the keys
  2022. of the receiver collection.
  2023. .Rs keysSelect:
  2024. Similar to \fIselect\fP, except that the selection is made on the basis of keys
  2025. instead of values.
  2026. .Rs removeKey:
  2027. Remove the object with the given key from the receiver collection.
  2028. Print an error message, and return \fBnil\fP, if no such object exists.
  2029. Return the value of the deleted item.
  2030. .Rs removeKey:ifAbsent:
  2031. Remove the object with the given key from the receiver collection.
  2032. Return the result of evaluating the second argument if no such object
  2033. exists.
  2034. .Rs values
  2035. Return a Bag containing the values from the receiver collection.
  2036. i \(<- 'abacadabra'
  2037. i atAll: (1 to: 7 by: 2) put: $e    ebecedebra
  2038. i indexOf: $r    9
  2039. i atAll: i keys put: $z    zzzzzzzzzz
  2040. i keys    Set ( 1 2 3 4 5 6 7 8 9 10 )
  2041. i values    Bag ( $z $z $z $z $z $z $z $z $z $z )
  2042. #(how odd) asDictionary    Dictionary ( 1 @ #how 2 @ odd )
  2043. .Nm Object Collection KeyedCollection Dictionary
  2044. A \fBDictionary\fP is an unordered collection of elements, as are \fBBags\fP
  2045. and \fBSets\fP.
  2046. However, unlike these collections, elements inserted and removed from
  2047. a \fBDictionary\fP must reference an explicit key.  Both the key and value
  2048. portions of an element can be any object, although commonly the keys are
  2049. instances of \fBSymbol\fP or \fBNumber\fP.
  2050. Responds to
  2051. .Rs at:put:
  2052. Place the second argument into the receiver collection under the key given
  2053. by the first argument.
  2054. .Rs currentKey
  2055. Return the key of the last element yielded in response to a \fIfirst\fP or
  2056. \fInext\fP request.
  2057. .Rs first n
  2058. Return the first element of the receiver collection.
  2059. Return nil if the receiver collection is empty.
  2060. .Rs next n
  2061. Return the next element of the receiver collection, or nil if no such element
  2062. exists.
  2063. .ta 3i
  2064. i \(<- Dictionary new
  2065. i at: #abc put: #def
  2066. i at: #pqr put: #tus
  2067. i at: #xyz put: #wrt
  2068. i print    Dictionary ( #abc @ #def #pqr @ #tus #xyz @ #wrt )
  2069. i size    3
  2070. i at: #pqr    #tus
  2071. i indexOf: #tus    #pqr
  2072. i keys    Set ( #abc #pqr #xyz )
  2073. i values    Bag ( #wrt #def # tus )
  2074. i collect: [:x | x asString at: 2]    Dictionary ( #abc @ $e #pqr @ $u #xyz @ $r)
  2075. .Nm Object Collection KeyedCollection Dictionary Smalltalk
  2076. The class \fBSmalltalk\fP provides protocol for the pseudo variable
  2077. \fBsmalltalk\fP.
  2078. Since it is a subclass of Dictionary, this variable can be used to store
  2079. information, and thus provide a means of communication between objects.
  2080. Other messages modify various parameters used by the Little Smalltalk system.
  2081. Responds To
  2082. .Rs date n
  2083. Return the current date and time as a string.
  2084. .Rs display n
  2085. Set execution display to display the result of every expression typed, but
  2086. not for assignments.
  2087. Note that the display behavior can also be modified using the \-d argument
  2088. on the command line.
  2089. .Rs displayAssign n
  2090. Set execution display to display the result of every expression typed,
  2091. including assignment statements.
  2092. .Rs doPrimitive:withArguments: n
  2093. Execute the indicated primitive with arguments given by the second array.
  2094. A few primitives (such as those dealing with process management) cannot be
  2095. executed in this manner.
  2096. .Rs noDisplay n
  2097. Turn off execution display - no results will be displayed unless explicitly
  2098. requested by the user.
  2099. .Rs perform:withArguments: d
  2100. Send indicated message to the receiver, using the arguments given.
  2101. The first value in the argument array is taken to be the receiver of
  2102. the message.
  2103. Unpredictable results if the number of arguments is not appropriate for
  2104. the given message.
  2105. .Rs sh: n
  2106. The argument, which must be a string, is executed as a Unix command by the
  2107. shell.  The value returned is the termination status of the shell.
  2108. .Rs time: n
  2109. The argument must be a block.  The block is executed, and the number of
  2110. seconds elapsed during execution returned.  Time is only accurate to within
  2111. about one second.
  2112. smalltalk date    Fri Apr 12 16:15:42 1985
  2113. smalltalk perform: #+ withArguments: #(2 5)    7
  2114. smalltalk doPrimitive: 10 withArguments: #(2 5)    7
  2115. .Nm Object Collection KeyedCollection SequenceableCollection
  2116. The class \fBSequenceableCollection\fP contains protocol for collections that have
  2117. a definite sequential ordering and are indexed by integer keys.
  2118. Since there is a fixed order for elements, it is possible to refer to the
  2119. last element in a \fBSequenceableCollection\fP.
  2120. Responds to
  2121. .Rs ,
  2122. Appends the argument collection to the receiver collection, returning a new
  2123. collection of the same type as the receiver.
  2124. .Rs copyFrom:to:
  2125. Return a new collection, like the receiver, containing the designated
  2126. subportion of the receiver collection.
  2127. .Rs copyWith:
  2128. Return a new collection, like the receiver, with the argument added to
  2129. the end.
  2130. .Rs copyWithout:
  2131. Return a new collection, like the receiver, with all occurrences of
  2132. the argument removed.
  2133. .Rs equals:startingAt:
  2134. The first argument must be a \fBSequenceableCollection\fP.
  2135. Return true if each element of the receiver collection is equal to the
  2136. corresponding element in the argument offset by the amount given in
  2137. the second argument.
  2138. .Rs findFirst:
  2139. Find the key for the first element whose value satisfies the
  2140. argument block.
  2141. Produce an error message if no such element exists.
  2142. .Rs findFirst:ifAbsent:
  2143. Both arguments must be blocks.
  2144. Find the key for the first element whose value satisfies the first argument block.
  2145. If no such element exists return the value of the
  2146. second argument.
  2147. .Rs findLast:
  2148. Find the key for the last element whose value satisfies the argument block.
  2149. Produce an error message if no such element exists.
  2150. .Rs findLast:ifAbsent:
  2151. Both arguments must be blocks.
  2152. Find the key for the last element whose value satisfies the first argument block.
  2153. If no such element exists return the value of the second argument block.
  2154. .Rs firstKey
  2155. Return the first key valid for the receiver collection.
  2156. .Rs indexOfSubCollection:startingAt:
  2157. Starting at the position given by the second argument, find the next
  2158. block of elements in the receiver collection which match the collection
  2159. given by the first argument, and return the index for the start of that block.
  2160. Produce an error message if no such position
  2161. exists.
  2162. .Rs indexOfSubCollection:startingAt:ifAbsent:
  2163. Similar to \fIindexOfSubCollection:startingAt:\fP, except that the result of the
  2164. exception block is produced if no position exists matching the pattern.
  2165. .Rs last
  2166. Return the last element in the receiver collection.
  2167. .Rs lastKey
  2168. Return the last key valid for the receiver collection.
  2169. .Rs replaceFrom:to:with:
  2170. Replace the elements in the receiver collection in the positions indicated
  2171. by the first two arguments with values taken from the collection given
  2172. by the third argument.
  2173. .Rs replaceFrom:to:with:startingAt:
  2174. Replace the elements in the receiver collection in the positions indicated
  2175. by the first two arguments with values taken from the collection given
  2176. in the third argument, starting at the position given by the fourth
  2177. argument.
  2178. .Rs reversed n
  2179. Return a collection, like the receiver, with elements reversed.
  2180. .Rs reverseDo:
  2181. Similar to \fIdo\fP:, except that the items are presented in reverse order.
  2182. .Rs sort n
  2183. Return a collection, like the receiver, with the elements sorted
  2184. using the comparison <=.  Elements must be able to respond to the binary
  2185. message <=.
  2186. .Rs sort: n
  2187. The argument must be a two argument block which yields a boolean.
  2188. Return a collection, like the receiver, sorted using the argument
  2189. to compare elements for the purpose of ordering.
  2190. .Rs with:do:
  2191. The second argument must be a two argument block.
  2192. Present one element from the receiver collection and from the collection
  2193. given by the first argument in turn to the second argument block.
  2194. An error message is given if the collections do not have the same number of
  2195. elements.
  2196. i \(<- 'abacadabra'
  2197. i copyFrom: 4 to: 8    cadab
  2198. i copyWith: $z    abacadabraz
  2199. i copyWithout: $a    bcdbr
  2200. i findFirst: [:x | x > $m]    9
  2201. i indexOfSubCollection: 'dab' startingAt: 1    6
  2202. i reversed    arbadacaba
  2203. i , i reversed    abacadabraarbadacaba
  2204. i sort: [:x :y | x >= y]    rdcbbaaaaa    
  2205. .Nm Object Collection KeyedCollection SequenceableCollection Interval
  2206. The class \fBInterval\fP represents a sequence of numbers in an arithmetic
  2207. sequence, either ascending or descending.  Instances of \fBInterval\fP are
  2208. created by numbers in response to the message \fIto:\fP or \fIto:by:\fP.
  2209. In conjunction with the message \fIdo:\fP, \fBIntervals\fP create a control
  2210. structure similar to do or for loops in Algol like languages.  For example:
  2211. .DS B
  2212. (1 to: 10) do: [:x | x print]
  2213. will print the numbers 1 through 10.
  2214. Although they are a collection, \fBIntervals\fP cannot be added to.
  2215. They can, however, be accessed randomly using the message \fIat\fP:.
  2216. Responds to
  2217. .Rs first
  2218. Produce the first element from the interval.  In conjunction with
  2219. \fIlast\fP, this message may be used to produce each element from the
  2220. interval in turn.  Note that \fBIntervals\fP also respond to the message
  2221. \fIat:\fP, which can be used to produce elements in an arbitrary order.
  2222. .Rs from:to:by:
  2223. Initialize the upper and lower bounds and the step size for the receiver.
  2224. (This is used principally internally by the method for number to create new
  2225. Intervals).
  2226. .Rs next
  2227. Produce the next element from the interval.
  2228. .Rs size
  2229. Return the number of elements that will be generated in producing the
  2230. interval.
  2231. (7 to: 13 by: 3) asArray    #( 7 10 13 )
  2232. (7 to: 13 by: 3) at: 2    10
  2233. (1 to: 10) inject: 0 into: [:x :y | x + y]    55
  2234. (7 to: 13) copyFrom: 2 to: 5    #( 8 9 10 11 )
  2235. (3 to: 5) copyWith: 13    #( 3 4 5 13 )
  2236. (3 to: 5) copyWithout: 4    #( 3 5 )
  2237. (2 to: 4) equals: (1 to: 4) startingAt: 2    True
  2238. .Nm Object Collection KeyedCollection SequenceableCollection List
  2239. Lists represent collections with a fixed order, but indefinite
  2240. size.  No keys are used, and elements are added or removed from one end of
  2241. the other.
  2242. Used in this way, Lists
  2243. can perform as \fIstacks\fP or as \fIqueues\fP.  The table below
  2244. illustrates how stack and queue operations can be implemented in terms
  2245. of messages to instances of List.
  2246. center;
  2247. l s | l s
  2248. l l | l l.
  2249. \fIstack operations\fP    \fIqueue operations\fP
  2250. push    addLast:    add    addLast:    
  2251. pop    removeLast    first in queue    first    
  2252. top    last    remove first in queue    removeFirst
  2253. test empty    isEmpty    test empty    isEmpty
  2254. Responds to
  2255. .Rs add:
  2256. Add the element to the beginning of the receiver collection.  This is the same
  2257. as \fIaddFirst:\fP.
  2258. .Rs addAllFirst:
  2259. The argument must be a SequenceableCollection.  The elements of the argument
  2260. are added, in order, to the front of the receiver collection.
  2261. .Rs addAllLast:
  2262. The argument must be a SequenceableCollection.  The elements of the argument
  2263. are added, in order, to the end of the receiver collection.
  2264. .Rs addFirst:
  2265. The argument is added to the front of the receiver collection.
  2266. .Rs addLast:
  2267. The argument is added to the back of the receiver collection.
  2268. .Rs removeFirst
  2269. Remove the first element from the receiver collection, returning the
  2270. removed value.
  2271. .Rs removeLast
  2272. Remove the last element from the receiver collection, returning the
  2273. removed value.
  2274. i \(<- List new
  2275. i addFirst: 2 / 3    List ( 0.6666 )
  2276. i add: $A    
  2277. i addAllLast: (12 to: 14 by: 2)
  2278. i print    List ( 0.6666 $A 12 14 )
  2279. i first    0.6666
  2280. i removeLast    14
  2281. i print    List ( 0.6666 $A 12 )
  2282. .Nm Object Collection KeyedCollection SequenceableCollection List Semaphore
  2283. Semaphores are used to synchronize concurrently running \fBProcesses\fP.
  2284. Responds To
  2285. .Rs new:
  2286. If created using \fInew\fP, a \fBSemaphore\fP starts out with zero excess
  2287. signals.  Alternatively, a \fBSemaphore\fP can be created with an arbitrary
  2288. number of excess signals by giving it an argument to \fInew\fP:.
  2289. .Rs signal
  2290. If there is a process blocked on the semaphore is it scheduled for
  2291. execution, otherwise
  2292. the number of excess signals is incremented by one.
  2293. .Rs wait
  2294. If there are excess signals associated with the semaphore the number of
  2295. signals is decremented by one, otherwise
  2296. the current process is placed on the semaphore queue.
  2297. .Nm Object Collection KeyedCollection SequenceableCollection File
  2298. A \fBFile\fP is a type of collection where the elements of the collection are
  2299. stored on an external medium, typically a disk.
  2300. For this reason, although most operations on collections are defined for
  2301. files, many can be quite slow in execution.
  2302. A file can be opened on one of three \fImodes\fP:
  2303. In \fIcharacter\fP mode every read returns a single character from the
  2304. file.
  2305. In \fIinteger\fP mode every read returns a single word, as an integer value.
  2306. In \fIstring\fP mode every read returns a single line, as a \fBString\fP.
  2307. For writing, character and string modes will write the string representation
  2308. of the argument, while integer mode must write only a single integer.
  2309. Responds To
  2310. .Rs at:
  2311. Return the object stored at the indicated position.  Position is given as a
  2312. character count from the start of the file.
  2313. .Rs at:put:
  2314. Place the object at the indicated position in the file.  Position is given
  2315. as a character count from the start of the file.
  2316. .Rs characterMode
  2317. Set the mode of the receiver file to \fIcharacter\fP.
  2318. .Rs currentKey
  2319. Return the current position in the file, as a character count from the
  2320. start of the file.
  2321. .Rs integerMode
  2322. Set the mode of the receiver file to \fIinteger\fP.
  2323. .Rs open:
  2324. Open the indicated file for reading.
  2325. The argument must be a \fBString\fP.
  2326. .Rs open:for:
  2327. The \fIfor:\fP argument must be one of 'r', 'w' or 'r+'
  2328. (see fopen(3) in the Unix programmers
  2329. manual).  Open the file in the indicated mode.
  2330. .Rs read
  2331. Return the next object from the file.
  2332. .Rs size
  2333. Return the size of the file, in character counts.
  2334. .Rs stringMode
  2335. Set the mode of the receiver file to \fIstring\fP.
  2336. .Rs write:
  2337. Write the argument into the file.
  2338. .Nm Object Collection KeyedCollection SequenceableCollection ArrayedCollection
  2339. The class \fBArrayedCollection\fP provides protocol for collections with a
  2340. Fixed size and integer keys.
  2341. Unlike other collections, which are created using the message \fInew\fP,
  2342. instances of \fBArrayedCollection\fP must be created using the one argument
  2343. message \fInew:\fP.  The argument given with this message must be a positive
  2344. integer, representing the size of the collection to be created.
  2345. In addition to the protocol shown, many of the methods inherited
  2346. from superclasses are redefined in this class.
  2347. Responds to
  2348. .Rs =
  2349. The argument must also be an \fBArray\fP.  Test whether the receiver and the
  2350. argument have equal elements listed in the same order.
  2351. .Rs at:ifAbsent:
  2352. Return the element stored with the given key.  Return the result
  2353. of evaluating the second argument if the key is not valid for the
  2354. receiver collection.
  2355. .Rs padTo: n
  2356. Return an array like the received that is at least as long as the argument
  2357. value.  Returns the receiver if it is already longer than the argument.
  2358. \&'small' = 'small'    True
  2359. \&'small' = 'SMALL'    False
  2360. \&'small' asArray    #( $s $m $a $l $l)
  2361. \&'small' asArray = 'small'    True
  2362. #(1 2 3) padTo: 5    #(1 2 3 nil nil)
  2363. #(1 2 3) padTo: 2    #(1 2 3)
  2364. .Nm Object Collection KeyedCollection SequenceableCollection ArrayedCollection Array
  2365. Instances of the class \fBArray\fP are perhaps the most commonly used
  2366. data structure in Smalltalk programs.
  2367. \fBArrays\fP are represented textually by a pound sign preceding the list of
  2368. array elements.
  2369. Responds to
  2370. .Rs at:
  2371. Return the item stored in the position given by the argument.
  2372. An error message is produced, and \fBnil\fP returned, if the argument is not
  2373. a valid key.
  2374. .Rs at:put:
  2375. Store the second argument in the position given by the first argument.
  2376. An error message is produced, and \fBnil\fP returned, if the argument is not
  2377. a valid key.
  2378. .Rs grow:
  2379. Return a new array one element larger than the receiver, with the argument
  2380. value attached to the end.  This is a slightly more efficient command than
  2381. \fIcopyWith:\fP, although the effect is the same.
  2382. i \(<- #(110 101 97)
  2383. i size    3
  2384. i \(<- i grow: 116    #( 110 101 97 116)
  2385. i \(<- i collect: [:x | x asCharacter]    #( #n #e #a #t )
  2386. i asString    neat
  2387. .Nm Object Collection KeyedCollection SequenceableCollection ArrayedCollection ByteArray
  2388. A \fBByteArray\fP is a special form of array in which the elements must be
  2389. numbers in the range 0-255.  Instances of \fBByteArray\fP are given a very
  2390. compact encoding, and are used extensively internally in the Little
  2391. Smalltalk system.
  2392. A \fBByteArray\fP can be represented textually by a pound sign preceding
  2393. the list of array elements surrounded by a pair of square braces.
  2394. Responds to
  2395. .Rs at:
  2396. Return the item stored in the position given by the argument.
  2397. An error message is produced, and \fBnil\fP returned, if the argument is not
  2398. a valid key.
  2399. .Rs at:put:
  2400. Store the second argument in the position given by the first argument.
  2401. An error message is produced, and \fBnil\fP returned, if the argument is not
  2402. a valid key.
  2403. i \(<- #[110 101 97]
  2404. i size    3
  2405. i \(<- i copyWith: 116    #[ 110 101 97 116 ]
  2406. i \(<- i asArray collect: [:x | x asCharacter]    #( #n #e #a #t )
  2407. i asString    neat
  2408. .Nm Object Collection KeyedCollection SequenceableCollection ArrayedCollection String
  2409. Instances of the class \fBString\fP are similar to \fBArrays\fP, except
  2410. that the individual elements
  2411. must be \fBCharacter\fP.  \fBStrings\fP are represented literally by placing single
  2412. quote marks around the characters making up the string.
  2413. \fBStrings\fP also differ from \fBArrays\fP in that
  2414. Strings possess an ordering, given by the underlying ascii sequence.
  2415. Responds to
  2416. .Rs ,
  2417. Concatenates the argument to the
  2418. receiver string, producing a new string.
  2419. If the argument is not a \fBString\fP it is first converted
  2420. using \fIprintString\fP.
  2421. .Rs <
  2422. The argument must be a \fBString\fP.  Test if the receiver is lexically
  2423. less than the argument.  For the purposes of comparison case differences
  2424. are ignored.
  2425. .Rs <=
  2426. Test if the receiver is lexically less than or equal to the
  2427. argument.
  2428. .Rs >=
  2429. Test if the receiver is lexically greater than or equal to the argument.
  2430. .Rs >
  2431. Test if the receiver is lexically greater than the argument.
  2432. .Rs asSymbol r
  2433. Return a \fBSymbol\fP with characters given by the receiver string.
  2434. .Rs at:
  2435. Return the character stored at the position given by the argument.
  2436. Produce and error message, and return \fBnil\fP, if the argument does not represent
  2437. a valid key.
  2438. .Rs at:put:
  2439. Store the character given by second argument at the location given by
  2440. the first argument.  Produce an error message, and return \fBnil\fP, if either
  2441. argument is invalid.
  2442. .Rs copyFrom:length: n
  2443. Return a substring of the receiver.  The substring is taken from the
  2444. indicated starting position in the receiver and extends for the given length.
  2445. Produce an error message, and return \fBnil\fP, if the given positions are
  2446. not legal.
  2447. .Rs copyFrom:to: r
  2448. Return a substring of the receiver.  The substring is taken from the
  2449. indicated positions.
  2450. Produce an error message, and return \fBnil\fP, if the given positions are
  2451. not legal.
  2452. .Rs printAt: n
  2453. The argument must be a \fBPoint\fP which describes a location on the
  2454. terminal screen.  The string is printed at the specified location.
  2455. .Rs size
  2456. Return the number of characters stored in the string.
  2457. .Rs sameAs:
  2458. Return true if the receiver and argument string match with the exception of
  2459. case differences.  Note that the boolean message = , inherited from
  2460. ArrayedCollection, can be used to see if two strings are the same including
  2461. case differences.
  2462. \&'example' at: 2    $x
  2463. \&'bead' at: 1 put: $r    read
  2464. \&'small' > 'BIG'    True
  2465. \&'small' sameAs: 'SMALL'    True
  2466. \&'tary' sort    arty
  2467. \&'Rats live on no evil Star' reversed    ratS live on no evil staR
  2468. .Nm Object Block
  2469. Although it is easy for the programmer to think of blocks as a syntactic
  2470. construct, or a control structure, they are actually objects, and share
  2471. attributes of all other objects in the Smalltalk system, such as the
  2472. ability to respond to messages.
  2473. Responds to
  2474. .Rs fork
  2475. Start the block executing as a \fBProcess\fP.
  2476. The value \fBnil\fP is immediately returned,
  2477. and the \fBProcess\fP created from the block
  2478. is scheduled to run in parallel with the current process.
  2479. .Rs forkWith:
  2480. Similar to \fIfork\fP, except that the array is passed as arguments to the
  2481. receiver block prior to scheduling for execution.
  2482. .Rs newProcess
  2483. A new \fBProcess\fP is created for the block, but is not
  2484. scheduled for execution.
  2485. .Rs newProcessWith: n
  2486. Similar to \fInewProcess\fP, except that the array is passed as arguments to the
  2487. receiver block prior to it being made into a process.
  2488. .Rs value
  2489. Evaluates the receiver block.  Produces an error message, and returns nil,
  2490. if the receiver block required arguments.  Return the value yielded by
  2491. the block.
  2492. .Rs value:
  2493. Evaluates the receiver block.  Produces an error message, and returns nil,
  2494. if the receiver block did not require a single argument.  Return the
  2495. value yielded by the block.
  2496. .Rs value:value:
  2497. Two argument block evaluation.
  2498. .Rs value:value:value:
  2499. Three argument block evaluation.
  2500. .Rs value:value:value:value:
  2501. Four argument block evaluation.
  2502. .Rs value:value:value:value:value:
  2503. Five argument block evaluation.
  2504. .Rs whileTrue:
  2505. The receiver block is repeatedly evaluated.  While it evaluates to true,
  2506. the argument block is also evaluated.  Return nil when the receiver block
  2507. no longer evaluates to true.
  2508. .Rs whileTrue
  2509. The receiver block is repeatedly evaluated until it returns a value that is
  2510. not true.
  2511. .Rs whileFalse:
  2512. The receiver block is repeatedly evaluated.  While it evaluates to false,
  2513. the argument block is also evaluated.  Return nil when the receiver block
  2514. no longer evaluates to false.
  2515. .Rs whileFalse
  2516. The receiver block is repeatedly evaluated until it returns a value that is
  2517. not false.
  2518. ['block indeed'] value    block indeed
  2519. [:x :y | x + y + 3] value: 5 value: 7    15
  2520. .Nm Object Class
  2521. The class \fBClass\fP provides protocol for manipulating class instances.
  2522. An instance of class \fBClass\fP is generated for each class in the Smalltalk
  2523. system.  New instances of this class are then formed by sending messages
  2524. to the class instance.
  2525. Responds to
  2526. .Rs deepCopy: n
  2527. The argument must be an instance of the receiver class.  A deepCopy
  2528. of the argument is returned.
  2529. .Rs edit n
  2530. The user is placed into a editor editing the file from which the class
  2531. description was originally obtained.  When the editor terminates, the class
  2532. description will be reparsed and will override the previous description.
  2533. See also \fIview\fP (below).
  2534. .Rs list n
  2535. Lists all subclasses of the given class recursively.
  2536. In particular, \fBObject\fP \fIlist\fP will list the names of all the
  2537. classes in the system.
  2538. .Rs new
  2539. A new instance of the receiver class is returned.  If the methods for
  2540. the receiver contain protocol for \fInew\fP, the new instance will
  2541. first be passed this message.
  2542. .Rs new:
  2543. A new instance of the receiver class is returned.  If the methods for
  2544. the receiver contain protocol for \fInew:\fP, the new instance will
  2545. first be passed this message.
  2546. .Rs respondsTo n
  2547. List all the messages that the current class will respond to.
  2548. .Rs respondsTo: d
  2549. The argument must be a Symbol.  Return true if the receiver class,
  2550. or any of its superclasses, contains a method
  2551. for the indicated message. Return false otherwise.
  2552. .Rs shallowCopy: n
  2553. The argument must be an instance of the receiver class.  A shallowCopy
  2554. of the argument is returned.
  2555. .Rs superClass n
  2556. Return the superclass of the receiver class.
  2557. .Rs variables n
  2558. Return an array containing the names of the instance variables used in
  2559. the receiver class.
  2560. .Rs view n
  2561. Place the user into an editor viewing the class description from which the
  2562. class was created.  Changes made to the file will not, however, affect the
  2563. current class representation.
  2564. Array new: 3    #( nil nil nil )
  2565. Bag respondsTo: #add:    True
  2566. SequenceableCollection superClass    KeyedCollection
  2567. .Nm Object Process
  2568. Processes are created by the system, or by passing the message \fInewProcess\fP
  2569. or \fIfork\fP to a block; they cannot be created directly by the user.
  2570. Responds To
  2571. .Rs block
  2572. The receiver process is marked as being blocked.  This is usually
  2573. the result of a semaphore wait.
  2574. Blocked processes are not executed.
  2575. .Rs resume
  2576. If the receiver process has been \fIsuspend\fPed, it is rescheduled for
  2577. execution.
  2578. .Rs suspend
  2579. If the receiver process is scheduled for execution, it is marked as
  2580. suspended.  Suspended processes are not executed.
  2581. .Rs state
  2582. The current state of the receiver process is returned as a Symbol.
  2583. .Rs terminate
  2584. The receiver process is terminated.  Unlike a blocked or suspended process,
  2585. a terminated process cannot be restarted.
  2586. .Rs unblock
  2587. If the receiver process is currently blocked, it is scheduled for
  2588. execution.
  2589. .Rs yield
  2590. Returns \fBnil\fP.  As a side effect, however,
  2591. if there are pending processes the current process is
  2592. placed back on the process queue and another process started.
  2593. echo unbundling st.1 1>&2
  2594. cat >st.1 <<'End'
  2595. .TH st 1 "local"
  2596. .SH NAME
  2597. st \- a Little Smalltalk
  2598. .SH SYNOPSIS
  2599. st [options] [files]
  2600. .SH DESCRIPTION
  2601. \fBst\fP is an interpreter for a Smalltalk-like language.  For a complete
  2602. description of the language accepted by the interpreter see the user manual.
  2603. Options accepted by the command are as follows:
  2604. .IP \-a
  2605. If the \-a option is given statistics on the number of memory allocations
  2606. will be displayed following execution.
  2607. .IP \-d\fIdigit\fP
  2608. If the \fIdigit\fP is zero only those results explicitly requested by the
  2609. user will be printed.  If 1, the values of expressions typed at the
  2610. keyboard will be displayed (this is the default).
  2611. If 2, the values of expressions and the values
  2612. assigned in assignment statements will be displayed.
  2613. .IP \-f
  2614. The \-f option indicates fast loading should be used, which loads a binary
  2615. save image (see ``)s'' below) for the standard library.
  2616. .IP \-g
  2617. The next argument is taken to be the name of an additional library stored
  2618. in the system library area.  The library is loaded following the standard
  2619. prelude, just as if a ``)g'' directive were given at the beginning of
  2620. execution (see below).
  2621. .IP \-l
  2622. The next argument is taken to be the name of a file containing a binary
  2623. image saved using the )s directive (see below).  This binary image is
  2624. loaded prior to execution.
  2625. .IP \-m
  2626. Do not perform fast loading.  (Used when fastloading is the default).
  2627. .IP \-n
  2628. The \-n option, if given, suppresses the loading
  2629. of the standard library.
  2630. As this gives you a system with almost no functionality, it is seldom
  2631. useful except during debugging.
  2632. .IP \-r
  2633. The next argument is taken to be the name of a file of
  2634. Smalltalk commands.  The file is included prior to execution, just
  2635. as if a ``)r'' directive were given at the beginning of execution (see below).
  2636. .IP \-s
  2637. In normal operation, at the end of execution the number of reference
  2638. count increments and decrements is printed just prior to exit.
  2639. In the absence of cycles these two
  2640. figures should be equal.  Since cycles can cause large chunks of memory to
  2641. become unreachable, and seriously degrade performance, this information is
  2642. often useful in debugging.
  2643. The \-s option, if given, suppresses the printing of this information.
  2644. The files, if given, must contain class descriptions.  Consult the
  2645. reference manual for the syntax for class descriptions.  The classes
  2646. defined are included along with the standard library of classes before
  2647. execution begins.
  2648. Once execution begins, the cursor will tab over 8 spaces to indicate that
  2649. a command can be entered.
  2650. A command consists of a valid Smalltalk expression, without a terminating
  2651. period.
  2652. As each expression is entered it is executed by the Little Smalltalk
  2653. interpreter, and the results displayed.
  2654. The following system directives can be entered in place of commands:
  2655. .IP ")e filename"
  2656. Edit the named file, which must contain only class descriptions.
  2657. The Little Smalltalk system will suspend, leaving the user in an editor
  2658. for making changes to the named file.  Upon exiting the editor, the named
  2659. file will automatically be included, as with the )i directive (below).
  2660. The editor chosen by this command is taken from the variable EDITOR in the
  2661. user's environment.
  2662. .IP ")g filename"
  2663. Search for a file with the given name in the system library area.
  2664. If found, load the library in with the users classes.  This is useful for
  2665. creating libraries of commonly used classes which are not part of the
  2666. standard prelude, such as classes for statistics applications or for
  2667. graphics.
  2668. .IP ")i filename"
  2669. Include the named file.  The File must contain one or more class
  2670. descriptions.  The class descriptions are parsed, and if syntactically
  2671. legal new instances of class \fBClass\fP are added to the Smalltalk system.
  2672. .IP ")l filename"
  2673. Load a saved binary environment.  The file must have been previously
  2674. created using the )s directive (below).  The values of all variables are
  2675. overridden.
  2676. .IP ")r filename"
  2677. Read the named file.  The effect is just as if the lines in the file
  2678. had been typed at the keyboard.  The file cannot contain class
  2679. descriptions.
  2680. .IP ")s filename"
  2681. Save the current environment in the named file.  The values of all
  2682. variables will be saved, and can later be restored using the )l directive
  2683. (above).
  2684. .IP ")!string"
  2685. Execute the string following the exclamation point as
  2686. a Unix command.
  2687. .SH "Author"
  2688. Tim Budd, Department of Computer Science, Oregon State University
  2689. .SH "See Also"
  2690. Timothy A. Budd,
  2691. \fIA Little Smalltalk\fP, published by Addison Wesley.
  2692. .SH Bugs
  2693. Not all the Smalltalk-80 Language described in the Blue Book is supported;
  2694. see the user manual for details.
  2695. (Smalltalk-80 is a trademark of Xerox Corporation).
  2696. echo unbundling syntax 1>&2
  2697. cat >syntax <<'End'
  2698. .so macros
  2699. .ds CH
  2700. .Sx "Class Description"
  2701. ellipsewid = 1.3i
  2702. arrow
  2703. A: ellipse "class heading"
  2704. arc -> cw
  2705. ellipse "instance variables"
  2706. arc ->
  2707. arc cw
  2708. B: ellipse "protocol"
  2709. arrow
  2710. arrow from A.e to B.w
  2711. .Sx "Class Heading"
  2712. arrow
  2713. circle "\fBClass\fP"
  2714. arrow
  2715. ellipse "variable"
  2716. arrow right 3i
  2717. move left 3i
  2718. move right 0.1i
  2719. arc -> cw
  2720. ellipse "colon variable"
  2721. arc ->
  2722. arc cw
  2723. \fBvariable\fP defines the class name, must begin with an upper case letter.
  2724. \fBcolon variable\fP defines the superclass name, superclass is \fBObject\fP
  2725. if not given.
  2726. .Sx "Instance Variables"
  2727. arrow
  2728. circle "|"
  2729. arrow
  2730. A: ellipse "variable"
  2731. arc -> cw
  2732. arc cw
  2733. arrow left 1.3i
  2734. arc cw
  2735. arc cw
  2736. move to A.e
  2737. arrow
  2738. circle "|"
  2739. arrow
  2740. Instance variables must begin with a lower case letter.
  2741. .Sx "Protocol"
  2742. arrow
  2743. circle "["
  2744. arrow
  2745. A: ellipse "method"
  2746. arc -> cw
  2747. line down 0.2i
  2748. arc cw
  2749. arrow left 0.4i
  2750. circle "|"
  2751. arrow left 0.4i
  2752. arc cw
  2753. line up 0.2i
  2754. arc cw
  2755. move to A.e
  2756. arrow
  2757. circle "]"
  2758. arrow
  2759. Vertical bar separating methods \fBmust\fP be placed in column 1.
  2760. .Sx "Method"
  2761. arrow
  2762. A: ellipse "method pattern"
  2763. arc -> cw
  2764. ellipse "temporary variables"
  2765. arc ->
  2766. arc cw
  2767. C: ellipse "statements"
  2768. arrow
  2769. arrow from A.e to C.w
  2770. .Sx "Method Pattern"
  2771. A: arrow
  2772. ellipse "unary selector"
  2773. arrow right 3i
  2774. move to A
  2775. arc -> cw
  2776. line down 0.1i
  2777. B: arc
  2778. ellipse "binary selector"
  2779. arrow
  2780. ellipse "argument variable"
  2781. arc ->
  2782. line up 0.1i
  2783. arc -> cw
  2784. move to start of B
  2785. line down 0.6i
  2786. ellipse "keyword selector"
  2787. arrow
  2788. C: ellipse "argument variable"
  2789. line up 0.6i
  2790. move to C.e
  2791. right
  2792. arc -> cw
  2793. arc cw
  2794. arrow left 3.1i
  2795. arc -> cw
  2796. arc cw
  2797. Argument variables must begin with a lower case letter,
  2798. and must be distinct from instance variables.
  2799. .Sx "Temporary Variables"
  2800. arrow
  2801. circle "|"
  2802. arrow
  2803. A: ellipse "variable"
  2804. arc -> cw
  2805. arc cw
  2806. arrow left 1.3i
  2807. arc cw
  2808. arc cw
  2809. move to A.e
  2810. arrow
  2811. circle "|"
  2812. arrow
  2813. temporary variables must begin with lower case letters,
  2814. and must be distinct from both instance and argument variables.
  2815. .Sx "Statements"
  2816. arrow
  2817. A: line right 1.5i
  2818. move to start of A
  2819. arc -> cw
  2820. circle "\s+6\(ua\s-6"
  2821. arc ->
  2822. arc cw
  2823. B: ellipse "expression"
  2824. arrow right 2.5i
  2825. move to B.e
  2826. move right 0.5i
  2827. arc -> cw
  2828. circle "."
  2829. arc ->
  2830. arc cw
  2831. move to B.e
  2832. arc -> cw
  2833. line down 0.4i
  2834. arc -> cw
  2835. circle "."
  2836. arrow left 2.5i
  2837. arc cw
  2838. arrow up 0.4i
  2839. arc cw
  2840. .Sx "Expression"
  2841. A: arrow right 3.3i
  2842. move to start of A
  2843. arc -> cw
  2844. ellipse "variable"
  2845. arrow
  2846. B: circle "<\(mi"
  2847. arc ->
  2848. arc cw
  2849. C: ellipse "cascaded expression"
  2850. arrow
  2851. move to B.e
  2852. arc -> cw
  2853. arc cw
  2854. arrow left 2.3i
  2855. arc -> cw
  2856. arc cw
  2857. .Sx "Cascaded Expression"
  2858. arrow
  2859. ellipse "simple expression"
  2860. arrow right 3.5i
  2861. move left 0.5i
  2862. right
  2863. arc -> cw
  2864. arc cw
  2865. circle ";"
  2866. arrow
  2867. ellipse "continuation"
  2868. arc -> cw
  2869. arc cw
  2870. .Sx "Simple Expression"
  2871. arrow
  2872. A: ellipse "binary"
  2873. arrow
  2874. move to A.e
  2875. arc -> cw
  2876. line down 0.2i
  2877. arc cw
  2878. ellipse "keyword"
  2879. arc -> cw
  2880. line up 0.2i
  2881. arc cw
  2882. .Sx "Binary"
  2883. arrow
  2884. A: ellipse "unary"
  2885. arrow
  2886. move to A.e
  2887. arc -> cw
  2888. B: line down 0.2i
  2889. arc cw
  2890. ellipse "binary selector"
  2891. arc -> cw
  2892. line up 0.2i
  2893. arc cw
  2894. .Sx "Unary"
  2895. arrow
  2896. A: ellipse "primary"
  2897. B: line right 2i
  2898. arc -> cw
  2899. arc cw
  2900. ellipse "unary selector"
  2901. arc -> cw
  2902. arc cw
  2903. move to B.e
  2904. arrow right
  2905. .Sx "Primitive"
  2906. arrow right 0.2i
  2907. circle "<primitive" wid 0.7i
  2908. arrow right 0.2i
  2909. ellipse "unsigned integer"
  2910. A: line right 1.7i
  2911. arc -> cw
  2912. arc cw
  2913. ellipse "primary"
  2914. arc -> cw
  2915. arc cw
  2916. move to A.e
  2917. arrow right
  2918. circle ">"
  2919. arrow right
  2920. Unsigned integer must be a number in the range 0-255.
  2921. .Sx "Primary"
  2922. A: arrow right 2i
  2923. ellipse "variable"
  2924. arrow right 2i
  2925. move to start of A
  2926. move right 0.5i
  2927. arc -> cw
  2928. B: line down 0.1i
  2929. arrow right 1i
  2930. ellipse "literal"
  2931. arrow right 1i
  2932. arc ->
  2933. line up 0.1i
  2934. arc cw
  2935. move to end of B
  2936. C: arrow down 0.6i
  2937. arrow right 1i
  2938. ellipse "block"
  2939. arrow right 1i
  2940. arc ->
  2941. line up 0.6i
  2942. move to end of C
  2943. Z: arrow down 0.6i
  2944. arrow right 1i
  2945. ellipse "primitive"
  2946. arrow right 1i
  2947. arc ->
  2948. line up 0.6i
  2949. move to end of Z
  2950. arrow down 0.6i
  2951. circle "("
  2952. arrow
  2953. ellipse "cascaded expression"
  2954. arrow
  2955. circle ")"
  2956. arc ->
  2957. line up 0.6i
  2958. If variable begins with an upper case letter it is a class name, otherwise
  2959. variable must be instance, argument or temporary variable or pseudo variable
  2960. name.
  2961. .Sx "Continuation"
  2962. A: arrow
  2963. arrow right 1.5i
  2964. ellipse "unary selector"
  2965. Z: line right 1.5i
  2966. arrow right 0.5i
  2967. move to end of Z
  2968. arc -> cw
  2969. arrow down 2i
  2970. arc -> cw
  2971. arrow left 4.5i
  2972. arc -> cw
  2973. arrow up 2i
  2974. arc -> cw
  2975. move to end of A
  2976. arc -> cw
  2977. C: arrow down 0.4i
  2978. ellipse "binary selector"
  2979. arrow
  2980. ellipse "unary"
  2981. arc ->
  2982. line up 0.4i
  2983. arc cw
  2984. move to end of C
  2985. arrow down 0.6i
  2986. ellipse "keyword"
  2987. arrow
  2988. D: ellipse "binary"
  2989. arc ->
  2990. line up 0.6i
  2991. move to D.e
  2992. right
  2993. arc -> cw
  2994. arc cw
  2995. arrow left 3.1i
  2996. arc cw
  2997. arc -> cw
  2998. .Sx "Block"
  2999. arrow
  3000. A: circle "["
  3001. arrow right 2.2i
  3002. ellipse "statements"
  3003. arrow
  3004. circle "]"
  3005. arrow
  3006. move to A.e
  3007. arc -> cw
  3008. ellipse "block arguments" width 1.2i
  3009. arc ->
  3010. arc cw
  3011. The last statement cannot be followed by a period.
  3012. .Sx "Block Arguments"
  3013. arrow
  3014. A: ellipse "colon variable"
  3015. arrow
  3016. circle "|"
  3017. arrow
  3018. move to A.e
  3019. arc -> cw
  3020. arc cw
  3021. arrow left 1.3i
  3022. arc cw
  3023. arc cw
  3024. .Sx "Literal"
  3025. arrow right 1i
  3026. A: arrow
  3027. ellipse "number"
  3028. arrow right 1.5i
  3029. move to start of A
  3030. arc -> cw
  3031. B: line down 0.1i
  3032. ellipse "symbol"
  3033. arc ->
  3034. line up 0.1i
  3035. arc cw
  3036. move to end of B
  3037. C: arrow down 0.6i
  3038. ellipse "string"
  3039. arc ->
  3040. line up 0.6i
  3041. move to end of C
  3042. D: arrow down 0.6i
  3043. ellipse "character constant"
  3044. arc ->
  3045. line up 0.6i
  3046. move to end of D
  3047. H: arrow down 0.6i
  3048. ellipse "bytearray"
  3049. arc ->
  3050. line up 0.6i
  3051. move to end of H
  3052. E: arrow down 0.6i
  3053. ellipse "array constant"
  3054. arc ->
  3055. line up 0.6i
  3056. .Sx "Number"
  3057. A: arrow right 3.6i
  3058. move to start of A
  3059. arc -> cw
  3060. ellipse "base" width 0.8i
  3061. arc ->
  3062. arc cw
  3063. arc -> cw
  3064. ellipse "sign" width 0.8i
  3065. arc ->
  3066. arc cw
  3067. ellipse "unsigned number"
  3068. arrow
  3069. .Sx "Base"
  3070. arrow
  3071. ellipse "unsigned integer"
  3072. arrow
  3073. circle "r"
  3074. arrow
  3075. .Sx "Sign"
  3076. A: arrow
  3077. arrow right 3i
  3078. move to end of A
  3079. B: arc cw
  3080. circle "+"
  3081. arc cw
  3082. move to end of B
  3083. arrow down 0.6i
  3084. circle "\(mi"
  3085. arrow up 0.6i
  3086. .Sx "Unsigned Number"
  3087. arrow
  3088. A: ellipse "unsigned fraction"
  3089. arc -> cw
  3090. circle "e"
  3091. arrow right 0.25i
  3092. ellipse "sign" width 0.8i
  3093. arrow right 0.25i
  3094. ellipse "unsigned integer"
  3095. arc ->
  3096. arc cw
  3097. move to A.e
  3098. arrow right 4.2i
  3099. .Sx "Unsigned Fraction"
  3100. arrow
  3101. A: ellipse "unsigned integer"
  3102. arc -> cw
  3103. circle "."
  3104. arrow
  3105. ellipse "unsigned integer"
  3106. arc ->
  3107. arc cw
  3108. move to A.e
  3109. arrow right 4i
  3110. .Sx "Unsigned Integer"
  3111. arrow
  3112. A: circle "digit"
  3113. arrow
  3114. move to A.e
  3115. arc -> cw
  3116. arc cw
  3117. arrow left 0.5i
  3118. arc -> cw
  3119. arc cw
  3120. .Sx "Symbol"
  3121. arrow
  3122. circle "#"
  3123. arrow
  3124. A: circle "char"
  3125. arrow
  3126. move to A.e
  3127. arc cw
  3128. arc cw
  3129. arrow left 0.5i
  3130. arc cw
  3131. arc cw
  3132. char is any non-space character that is not one of period, parenthesis
  3133. or square braces.
  3134. .Sx "String"
  3135. arrow
  3136. circle "'"
  3137. arrow
  3138. A: circle "char"
  3139. arrow
  3140. circle "'"
  3141. arrow
  3142. move to A.e
  3143. arc cw
  3144. arc cw
  3145. arrow left 0.5i
  3146. arc cw
  3147. arc cw
  3148. To include a quote mark in a string, use two adjacent quote marks.
  3149. .Sx "Character Constant"
  3150. arrow
  3151. circle "$"
  3152. arrow
  3153. circle "char"
  3154. arrow
  3155. .Sx "Bytearray"
  3156. arrow
  3157. circle "#"
  3158. arrow
  3159. circle "["
  3160. arrow
  3161. A: ellipse "unsigned integer"
  3162. arrow
  3163. circle "]"
  3164. arrow
  3165. move to A.e
  3166. arc -> cw
  3167. arc cw
  3168. line left 1.3i
  3169. arc -> cw
  3170. arc cw
  3171. Integer must be in the range 0 through 255.
  3172. .Sx "Array Constant"
  3173. arrow
  3174. circle "#"
  3175. arrow
  3176. ellipse "array"
  3177. arrow
  3178. .Sx "Array"
  3179. arrow
  3180. circle "("
  3181. arrow
  3182. A: arc -> cw
  3183. ellipse "number"
  3184. arc ->
  3185. arc cw
  3186. B: arrow
  3187. circle ")"
  3188. arrow
  3189. move to start of A
  3190. arrow right 2.5i
  3191. move to end of A
  3192. C: arrow down 0.6i
  3193. ellipse "symbol"
  3194. arc ->
  3195. arrow up 0.6i
  3196. move to end of C
  3197. D: arrow down 0.6i
  3198. ellipse "string"
  3199. arc ->
  3200. arrow up 0.6i
  3201. move to end of D
  3202. E: arrow down 0.6i
  3203. ellipse "character constant"
  3204. arc ->
  3205. arrow up 0.6i
  3206. move to end of E
  3207. arrow down 0.6i
  3208. ellipse "array"
  3209. arc ->
  3210. arrow up 0.6i
  3211. move to start of B
  3212. right
  3213. arc -> cw
  3214. arrow down 3i
  3215. arc -> cw
  3216. arrow left 2.4i
  3217. arc -> cw
  3218. arrow up 3i
  3219. arc -> cw
  3220. The leading sharp sign can be omitted in symbols and arrays inside of
  3221. an array list.
  3222. Binary selectors, keywords, and other strings are treated as Symbols inside
  3223. of arrays.
  3224.